Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Setting up Nginx with subdomain and ssl

$
0
0
Hello,

Could someone please tell me if there is a better way to rewrite my config file.

I have 1 domain that has got several subdomain and ssl. From what you can see all the port listening on port 80 uses the same setting and the same apply for the port 443.

Thank you very much in advance

Fred
---

server {
listen 80 default;
server_name domain1.co.uk www.domain1.co.uk;
root /usr/local/www/webs/domain1_co_uk/live/httpdocs;
index index.php;

access_log /var/log/nginx/80.domain1.access.log;
error_log /var/log/nginx/80.domain1.error.log;

location / {
try_files $uri $uri/ /index.php;
}

location /search { limit_req zone=gulag burst=3 nodelay; rewrite ^ /index.php; }

fastcgi_intercept_errors off;

location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

include conf.d/php.conf;
include conf.d/drop.conf;
}
server {
listen 80;
server_name test.domain1.co.uk www.test.domain1.co.uk;
root /usr/local/www/webs/domain1_co_uk/test/httpdocs;
index index.php;

access_log /var/log/nginx/80.test.domain1.access.log;
error_log /var/log/nginx/80.test.domain1.error.log;
location / {
try_files $uri $uri/ /index.php;
}

location /search { limit_req zone=gulag burst=3 nodelay; rewrite ^ /index.php; }

fastcgi_intercept_errors off;

location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

include conf.d/php.conf;
include conf.d/drop.conf;
}
server {
listen 443 default_server ssl spdy accept_filter=dataready;
server_name domain1.co.uk www.domain1.co.uk;
root /usr/local/www/webs/domain1_co_uk/live/httpdocs;
index index.php;

access_log /var/log/nginx/443.domain1.access.log;
error_log /var/log/nginx/443.domain1.error.log;
location / {
try_files $uri $uri/ /index.php;
}

location /search { limit_req zone=gulag burst=3 nodelay; rewrite ^ /index.php; }

fastcgi_intercept_errors off;

location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

ssl_certificate /ssl_keys/example.com_ssl.crt;
ssl_certificate_key /ssl_keys/example.com_ssl.key;

include conf.d/php.conf;
include conf.d/drop.conf;
include conf.d/option-ssl
}
server {
listen 443;
server_name test.domain1.co.uk www.test.domain1.co.uk;
root /usr/local/www/webs/domain1_co_uk/test/httpdocs;
index index.php;

access_log /var/log/nginx/443.test.domain1.access.log;
error_log /var/log/nginx/443.test.domain1.error.log;
location / {
try_files $uri $uri/ /index.php;
}

location /search { limit_req zone=gulag burst=3 nodelay; rewrite ^ /index.php; }

fastcgi_intercept_errors off;

location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

ssl_certificate /ssl_keys/example.com_ssl.crt;
ssl_certificate_key /ssl_keys/example.com_ssl.key;

include conf.d/php.conf;
include conf.d/drop.conf;
include conf.d/option-ssl

}
server {
listen 443;
server_name ossec.domain1.co.uk;
root /usr/local/www/webs/domain1_co_uk/ossec/analogi;
index index.php;

access_log /var/log/nginx/443.ossec.domain1.access.log;
error_log /var/log/nginx/443.ossec.domain1.error.log;
location / {
try_files $uri $uri/ /index.php;
}

location /search { limit_req zone=gulag burst=3 nodelay; rewrite ^ /index.php; }

fastcgi_intercept_errors off;

location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

ssl_certificate /ssl_keys/example.com_ssl.crt;
ssl_certificate_key /ssl_keys/example.com_ssl.key;

include conf.d/php.conf;
include conf.d/drop.conf;
include conf.d/option-ssl
}

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>