Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
91 lines (71 sloc) 3.29 KB
server {
#listen 80;
listen [::]:80;
server_name git.bennythink.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/GitServer/gogs/public;
rewrite ^(.*)$ https://$host$1 permanent;
#error_page 404 /404.html;
#include enable-php.conf;
#include enable-php-pathinfo.conf;
location ~ .*\.(ico|gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
# valid_referers none blocked *.example.com *.google.com *.baidu.com *.so.com *.bing.com;
}
location ~ .*\.(js|css)?$ {
expires 12d;
}
location ~ /\. {
deny all;
}
location ~ /.well-known {
allow all;
}
access_log /home/wwwlogs/example.com;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name git.bennythink.com; # domain
index index.html index.htm index.php default.html default.htm default.php;
root /home/GitServer/gogs/public; # webroot
include enable-php.conf;
include enable-php-pathinfo.conf;
ssl_certificate /usr/local/cert/fullchain.pem; # cert
ssl_certificate_key /usr/local/cert/privkey.pem; # private key
ssl_session_timeout 20m;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
# generate with openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_ciphers 'TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_stapling on;
ssl_stapling_verify on;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Xss-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade";
add_header Content-Security-Policy "default-src https: 'unsafe-inline' 'unsafe-eval' data:;";
#error_page 404 /404.html;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:3000; # 对应端口号8080的tomcat
}
location /nginx_status {
stub_status on;
access_log off;
}
location ~ .*\.(ico|gif|jpg|jpeg|bmp|swf)$ {
expires 30d;
#valid_referers none blocked *.example.com *.google.com *.baidu.com *.so.com;
}
location ~ /.well-known {
allow all;
}
location ~ .*\.(js|css)?$ {
expires 12d;
}
access_log /home/wwwlogs/example.com; #log
}
You can’t perform that action at this time.