Created
December 12, 2018 07:50
-
-
Save contropist/65f48a41cd9d2b19903d2bda891bb794 to your computer and use it in GitHub Desktop.
Nginx configuration
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; | |
listen 443 ssl http2; | |
server_name cloud.liangs.me; | |
index index.php index.html index.htm default.php default.htm default.html; | |
root /www/wwwroot/cloud.liangs.me; | |
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则 | |
#error_page 404/404.html; | |
#HTTP_TO_HTTPS_START | |
if ($server_port !~ 443){ | |
rewrite ^(/.*)$ https://$host$1 permanent; | |
} | |
#HTTP_TO_HTTPS_END | |
ssl_certificate /etc/letsencrypt/live/cloud.liangs.me/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/cloud.liangs.me/privkey.pem; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; | |
ssl_prefer_server_ciphers on; | |
ssl_session_cache shared:SSL:10m; | |
ssl_session_timeout 10m; | |
error_page 497 https://$host$request_uri; | |
#SSL-END | |
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改 | |
error_page 404 /404.html; | |
error_page 502 /502.html; | |
#ERROR-PAGE-END | |
#PHP-INFO-START PHP引用配置,可以注释或修改 | |
include enable-php-00.conf; | |
#PHP-INFO-END | |
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效 | |
include /www/server/panel/vhost/rewrite/cloud.liangs.me.conf; | |
#REWRITE-END | |
proxy_set_header X-Forwarded-For $remote_addr; | |
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains"; | |
server_tokens off; | |
location / { | |
proxy_pass http://127.0.0.1:8000; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Host $server_name; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_read_timeout 1200s; | |
# used for view/edit office file via Office Online Server | |
client_max_body_size 0; | |
} | |
location /seafhttp { | |
rewrite ^/seafhttp(.*)$ $1 break; | |
proxy_pass http://127.0.0.1:8082; | |
client_max_body_size 0; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_connect_timeout 36000s; | |
proxy_read_timeout 36000s; | |
proxy_send_timeout 36000s; | |
send_timeout 36000s; | |
} | |
location /media { | |
root /root/seafile-pro-server-6.2.9/seahub; | |
} | |
#禁止访问的文件或目录 | |
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md) | |
{ | |
return 404; | |
} | |
#一键申请SSL证书验证目录相关设置 | |
location ~ \.well-known{ | |
allow all; | |
} | |
access_log /www/wwwlogs/cloud.liangs.me.log; | |
error_log /www/wwwlogs/cloud.liangs.me.error.log; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment