Nginx Conf 反向代理
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
listen 80;
server_name 網址;
ssl_certificate SSL鑰匙/cert.pem;
ssl_certificate_key SSL鑰匙/key.pem;
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" always;
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
location / {
proxy_pass 對應IP;
proxy_connect_timeout 300s;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_set_header Host $host:$proxy_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Via "nginx";
}
}
檔案路徑
vim /etc/nginx/sites-enabled/nginx
路徑視個人安裝為主
更改完之後重啟
systemctl reload nginx