我在我们网站上的 nginx 配置有问题。当我使用端口 80 运行配置时,我没有任何问题,但是当我使用 ssl 配置将所有内容移动到端口 443 时,站点不再响应。我已经尝试了很多,没有看到我在这里做错了什么。
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
include /etc/nginx/conf.d/*.conf;
#include /etc/nginx/sites-enabled/*;
server {
listen 80;
server_name landing.kayzr.com;
return 301 https://landing.kayzr.com;
}
server {
listen 443;
server_name landing.kayzr.com;
ssl on;
ssl_certificate /etc/ssl/ssl-bundle.crt;
ssl_certificate_key /etc/ssl/server.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DES-CBC3-SHA:!ADH:!AECDH:!MD5;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
add_header Strict-Transport-Security "max-age=63072000";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4;
root /var/www/html;
index index.php index.html index.htm;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
rewrite ^/(content|site|kirby)$ /error last;
rewrite ^/content/(.*).(txt|md|mdown)$ /error last;
rewrite ^/(site|kirby)/(.*)$ /error last;
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
location ~ /panel {
try_files $uri $uri/ /panel/index.php?$uri&$args;
}
location ~ / {
try_files $uri $uri/ /index.php?$uri&$args;
}
location ~ (?:^|/)\. {
deny all;
}
location ~ (?:\.(?:bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$ {
deny all;
}
}
}
奇怪的是,当我将所有内容从“root /var/www/html”复制到我的端口 80 服务器时,一切都在非 https 上运行。
任何帮助表示赞赏