Last active
January 3, 2016 14:19
-
-
Save gchacaltana/8475313 to your computer and use it in GitHub Desktop.
configuration nginx file with php-fpm
This file contains 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 443; | |
server_name api.project_name.pe; | |
ssl on; | |
ssl_certificate /etc/nginx/ssl/server.crt; | |
ssl_certificate_key /etc/nginx/ssl/server.key; | |
access_log /var/log/nginx/api.project_name.access.log; | |
error_log /var/log/nginx/api.project_name.error.log; | |
root /srv/www/project_name/api/v1/; | |
index index.php /index.php; | |
sendfile off; | |
location / { | |
if (-f $request_filename) { | |
break; | |
} | |
if (!-e $request_filename) { | |
rewrite ^(.+)$ /index.php?$1 last; | |
break; | |
} | |
} | |
# Pass PHP scripts to PHP-FPM | |
location ~ \.php$ { | |
fastcgi_index index.php; | |
fastcgi_pass unix:/tmp/api.project_name.sock; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
include fastcgi_params; | |
} | |
# if upstream is not available or crashes | |
error_page 500 502 503 504 /media/50x.html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment