Last active
November 5, 2022 09:26
-
-
Save Debcharon/d38619d85edbf1b09797c6235dea4ed0 to your computer and use it in GitHub Desktop.
The nginx vhost template for typecho, Manager for LNMP, lnmp.org
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
# @ HTTPS REDIRECT | |
server | |
{ | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
server_name example.com; | |
ssl_certificate /usr/local/nginx/conf/cert/example.com.crt; | |
ssl_certificate_key /usr/local/nginx/conf/cert/example.com.key; | |
return 301 https://www.example.com$request_uri; | |
} | |
# HTTP REDIRECT | |
server | |
{ | |
listen 80; | |
listen [::]:80; | |
server_name www.example.com; | |
index index.php index.html index.htm default.php default.html default.htm; | |
root /home/wwwroot/example.com; | |
return 301 https://www.example.com$request_uri; | |
#include rewrite/typecho.conf; | |
#error_page 404 /404.html; | |
# Deny access to PHP files in specific directory | |
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; } | |
include enable-php-pathinfo.conf; | |
location ~ .*\.(js|css)?$ | |
{ | |
expires 12h; | |
} | |
location ~ /.well-known { | |
allow all; | |
} | |
location ~ /\. | |
{ | |
deny all; | |
} | |
access_log /home/wwwlogs/example.com.log; | |
} | |
# TARGET | |
server | |
{ | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
server_name www.example.com; | |
index index.php index.html index.htm default.php default.html default.htm; | |
root /home/wwwroot/example.com; | |
ssl_certificate /usr/local/nginx/conf/cert/example.com.crt; | |
ssl_certificate_key /usr/local/nginx/conf/cert/example.com.key; | |
include rewrite/typecho.conf; | |
#error_page 404 /404.html; | |
# Deny access to PHP files in specific directory | |
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; } | |
include enable-php-pathinfo.conf; | |
location ~ .*\.(js|css)?$ | |
{ | |
expires 12h; | |
} | |
location ~ /.well-known { | |
allow all; | |
} | |
location ~ /\. | |
{ | |
deny all; | |
} | |
access_log /home/wwwlogs/example.com.log; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment