Created
February 27, 2019 12:27
-
-
Save ptflp/b68df4398f1fd88e6d6074b37837b28e to your computer and use it in GitHub Desktop.
nginx php-fpm config
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
upstream phpfpm { | |
server unix:/run/php/php7.0-fpm.sock; | |
} | |
server { | |
set $main_path /var/www/html; | |
server_name localhost default; | |
charset utf-8; | |
source_charset utf-8; | |
listen 0.0.0.0:80 ; | |
root $main_path; | |
index index.html index.php index.htm; | |
access_log /var/log/nginx/access.log; | |
client_max_body_size 16m; | |
location @router { | |
rewrite ^(.*)$ /router.php?$1; | |
} | |
location / { | |
index index.html index.php index.htm; | |
try_files $uri $uri/ @router; | |
index index.html index.php; | |
error_page 403 = @router; | |
error_page 404 = @router; | |
} | |
location ~ \.(js|css|png|jpeg|jpg|gif|swf|ico|pdf|mov|fla|zip|rar|ttf|woff|html)$ { | |
try_files $uri =404; | |
} | |
location ~ \.php$ { | |
try_files $fastcgi_script_name = /index.php; | |
include fastcgi_params; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
fastcgi_pass phpfpm; | |
fastcgi_read_timeout 300; | |
fastcgi_param SERVER_NAME $http_host; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment