I'm running a configuration on Plesk during which Plesk randomly overwrites my nginx.conf with a default template, so what I'm trying to do is change the template by including another configuration file if needed(something like how httpd.conf and vhost.conf) works, but the question is, would it work if i repeated the same tags, for example I have this nginx configuration:
server {
listen 72.25.454.19:80;
server_name example.com;
server_name www.example.com;
server_name ipv4.example.com;
client_max_body_size 128m;
location / { # IPv6 isn't supported in proxy_pass yet.
proxy_pass http://72.55.164.89:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
location /internal-nginx-static-location/ {
alias /usr/share/tomcat6/psa-webapps/example.com/example/;
access_log /var/www/vhosts/example.com/statistics/logs/proxy_access_log;
add_header X-Powered-By PleskLin;
internal;
}
}
and I added the same declaration only to change the alias, would nginx merge the two configurations, or just take the last one, not sure how it works.
server {
listen 72.25.454.19:80;
location /internal-nginx-static-location/ {
alias /usr/share/tomcat6/psa-webapps/example.com/example2/;
}
}
What you did is not the same server block without the server_name.
I would say that the 2nd config without server_name will be considered as default config. Then overruled by the 1st config with server_name.
There is also no redeclare location. For example...
I hope that helps.