General HTTP to HTTPS server { listen 80; listen [::]:80; servername example.com…
- User
General HTTP to HTTPS
server { listen 80; listen [::]:80; server_name example.com default_server;
location / { return 302 https://$host$request_uri; }}
server { listen 443 ssl; server_name example.com default_server;
root /var/www/example; index index.html; ssl_certificate /root/example.com.crt; ssl_certificate_key /root/example.com.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; location / { try_files $uri $uri/ =404; }}
server { listen 8877 ssl; listen [::]:8877 ssl; server_name example.com;
# Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; ssl_certificate /root/example.com.crt; ssl_certificate_key /root/example.com.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; location / { proxy_pass http://example.com:1111; }} 我在服务器上运行了 strapi cms 的启动程序 ,使用yarn develop 启动,端口 1337, 修改下 这个nginx 配置代码,让他支持 strapi 的https访问
- Assistant
为了支持 Strapi CMS 的 HTTPS 访问,您需要对您的 Nginx 配置进行一些修改以代理流量到 Strapi 运行的端口(在本例中是 1337)。这里是一个更新后的配置样本:
# General HTTP to HTTPS server { listen 80; listen [::]:80; server_name example.com; location / { return 302 https://$host$request_uri; } } # HTTPS server for the main domain server { listen 443 ssl; listen [::]:443 ssl; server_name example.com; root /var/www/example; index index.html; ssl_certificate /root/example.com.crt; ssl_certificate_key /root/example.com.key; ssl_protocols TLSv1.2 TLSv1.3; # Updated to include only secure protocols ssl_prefer_server_ciphers on; ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; location / { try_files $uri $uri/ =404; } location /strapi { proxy_pass http://localhost:1337; proxy_http_version 1.1; proxy_set_header Host $http_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-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } } # Additional server block for SSL on port 8877 server { listen 8877 ssl; listen [::]:8877 ssl; server_name example.com; ssl_certificate /root/example.com.crt; ssl_certificate_key /root/example.com.key; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; location / { proxy_pass http://localhost:1337; proxy_http_version 1.1; proxy_set_header Host $http_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-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.