Last active
August 29, 2015 13:56
-
-
Save mightydes/9271889 to your computer and use it in GitHub Desktop.
Nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# any php file | |
location ~ \.php$ { | |
# drop 404 on file not found | |
try_files $fastcgi_script_name =404; | |
# or route to index.php on file not found | |
#try_files $fastcgi_script_name /index.php?$args; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location ~ ^/(index|app|config|some/api)\.php(/|$) { | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location / { | |
access_log off; | |
proxy_pass http://{ip}; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name uploads.example.com; | |
location ~ ^.+\.(jpeg|gif|png|jpg) { | |
access_log off; | |
add_header Cache-control "public"; | |
expires 90d; | |
proxy_pass http://127.0.0.1:8890; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment