我在网站上对我的Nginx配置有问题。当我使用端口80运行配置时,我没有问题,但是当我将所有内容移至端口443时,我的SSL配置网站不再响应。我尝试了很多,看不到我在这里做错了什么。
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上起作用。
任何帮助
好吧,我应该在stackoverflow上发布更多,每次我发布它(几个小时后我只这样做(,解决方案突然出现了。
文件是完全正确的。我的安全组在Azure上没有打开端口443。