我使用certbot安装Nginx,可以加密ssl。大多数配置由certbot完成。我使用https://www.ssllabs.com/ssltest/检查我的ssl及其工作。我遇到了我的域无法通过代理的问题。 sudo nginx -t正常工作。
我是新来的,我不知道我在哪里遇到问题。
nginx nginx.conf
user www-data;
worker_processes auto;
events {
worker_connections 1024;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
#tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 75;
types_hash_max_size 2048;
server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_certificate /etc/letsencrypt/live/mobile.niyazi.com/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/mobile.niyazi.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
#ssl_stapling on;
ssl_stapling_verify on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
#gzip on;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
#include /etc/nginx/sites-enabled/*;
}
nginx / conf.d / default.conf
server {
charset UTF-8;
listen 80 ;
listen [::]:80 ;
server_name mobile.niyazi.com; # managed by Certbot
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
if ($host = mobile.niyazi.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
# return 404; # managed by Certbot
}
server {
charset UTF-8;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
server_name mobile.niyazi.com; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mobile.niyazi.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mobile.niyazi.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
proxy_pass http://127.0.0.1:8888/;
}
}