Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In NGINX when setting up my different servers, I find that I have a lot of duplicate settings. For example, this setting returns in each separate server:

location ~ \.php {
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8080;
    }

Is there a way to make this global, so that it is shared with different servers?

share|improve this question

migrated from superuser.com Feb 25 '11 at 17:31

This question came from our site for computer enthusiasts and power users.

add comment

1 Answer

yes you could create a file in your nginx folder called say

phpcommon.conf

which could contain those elements

and in the nginx config block where they originally were you would have a line

include /etc/nginx/phpcommon.conf;

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.