Created
December 26, 2018 06:34
-
-
Save yangvipguang/8940fe51d8e14f1e28d847e1c7309eb1 to your computer and use it in GitHub Desktop.
nginx-php
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 80; | |
server_name example.com www.example.com; | |
return 301 https://www.example.com$request_uri; | |
} | |
server { | |
listen 443 ssl http2; | |
server_name example.com www.example.com; | |
root /var/www/html/example.com/; | |
index index.php index.html index.htm; | |
#charset koi8-r; | |
access_log /var/log/nginx/example.com/example.com_access_log; | |
error_log /var/log/nginx/example.com/example.com_error_log error; | |
# SSL/TLS configs | |
ssl_certificate /etc/ssl/certs/example_com_cert_chain.crt; | |
ssl_certificate_key /etc/ssl/private/example_com.key; | |
include /etc/nginx/ssl.d/ssl.conf; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /var/www/html/example.com/; | |
} | |
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 | |
# | |
#location ~ \.php$ { | |
# proxy_pass http://127.0.0.1; | |
#} | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
# | |
location ~ \.php$ { | |
root /var/www/html/example.com/; | |
fastcgi_pass 127.0.0.1:9001; | |
#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; | |
include /etc/nginx/fastcgi_params; | |
} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
# | |
#location ~ /\.ht { | |
# deny all; | |
#} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment