server { listen 80; listen [::]:80; #这里的IPV6地址根据情况可以不写 server_name example.com; #域名 if ($scheme = http) { #强制跳转https return 301 https://$server_name$request_uri; } } server { listen 443 ssl; access_log /var/log/nginx/vpn_access.log main; #指定访问日志 error_log /var/log/nginx/vpn_error.log error; #指定错误日志 server_name example.com; ssl_certificate /ssl/cert.pem; #证书路径 ssl_certificate_key /ssl/cert.key; #证书路径 ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { root /vpn/SSPanel-Uim/public; #网页目录 index index.html index.htm index.php; try_files $uri /index.php$is_args$args; } location ~ \.php$ { root /vpn/SSPanel-Uim/public; #网页目录 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi_params; } }