nginx 和 certbot 失败

nginx 和 certbot 失败

我正在尝试在我的 nginx 服务器上设置两个站点。

  1. pma(phpmyadmin)正常运行。
  2. myhome.domain.tld-不起作用。

这是 nginx.conf 文件。

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    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_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##
server {
listen 443 ssl http2;
    server_name pma.domain.tld; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/pma.domain.tld/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/pma.domain.tld/privkey.pem; # managed by Certbot
  include snippets/ssl-params.conf;
  client_max_body_size 40M;
  server_tokens off;
  root /srv/phpmyadmin/;

  index index.html index.php index.htm;


  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }
include /etc/nginx/apps/*;

  location ~ /\.ht {
    deny all;
  }

add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot

}
server {
listen 443 ssl http2;
      server_name myhome.domain.tld; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/myhome.domain.tld/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/myhome.domain.tld/privkey.pem; # managed by Certbot
  include snippets/ssl-params.conf;
  client_max_body_size 40M;
  server_tokens off;
  root /srv/myhome/;

  index index.html index.php index.htm;

  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }
include /etc/nginx/apps/*;

  location ~ /\.ht {
    deny all;
  }

add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot


    }
}

相关内容