Last active
November 2, 2018 10:48
-
-
Save curder/0c776ee5a3908d840bb59b4d20eab238 to your computer and use it in GitHub Desktop.
Nginx 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
server { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
# 设定网站根目录 | |
root /var/www/codes/project/public; | |
# 网站默认首页 | |
index index.php index.html index.htm; | |
# 服务器名称,server_domain_or_IP 请替换为自己设置的名称或者 IP 地址 | |
server_name server_domain_or_IP; | |
access_log /var/log/nginx/testing/project.com.access.log main; | |
error_log /var/log/nginx/testing/project.com.error.log; | |
# 修改为 Laravel 转发规则,否则PHP无法获取$_GET信息,提示404错误 | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
# PHP 支持 | |
location ~ \.php$ { | |
try_files $uri /index.php =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location ~* /\. { | |
deny all; | |
} | |
} |
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 localhost; | |
access_log /var/log/nginx/host.access.log main; | |
location / { | |
root html; | |
index index.html index.htm; | |
} | |
#error_page 404 /404.html; | |
# redirect server error pages to the static page /50x.html | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment