Welcome! Log In Create A New Profile

Advanced

Setting up Nginx with subdomain and ssl

Posted by The_Apprentice 
Setting up Nginx with subdomain and ssl
October 08, 2014 10:32AM
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
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 127
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready