VPS侦探论坛

 找回密码
 注册
查看: 3234|回复: 1

求助https配置出错

[复制链接]
发表于 2018-1-30 10:17:59 | 显示全部楼层 |阅读模式

用的是/usr/local/nginx/conf/enable-ssl-example.conf 配置,证书已修改为自己的证书,reload时提示如下错误:
Reload service nginx... nginx: [emerg] "server" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:2
系统为debian9.2 阿里云主机
详细配置如下:
  1. server
  2.         {
  3.         listen 443 ssl http2;
  4.         #listen [::]:443 ssl http2;
  5.         server_name xxx.com;
  6.         index index.html index.htm index.php default.html default.htm default.php;
  7.         root  /home/wwwroot/default;
  8.         ssl on;
  9.         ssl_certificate /usr/local/nginx/ssl/xxx.com.crt;
  10.         ssl_certificate_key /usr/local/nginx/ssl/xxx.com.key;
  11.         ssl_session_timeout 5m;
  12.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  13.         ssl_prefer_server_ciphers on;
  14.         ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
  15.         ssl_session_cache builtin:1000 shared:SSL:10m;
  16.         # openssl dhparam -out /usr/local/nginx/ssl/dhparam.pem 2048
  17.         #ssl_dhparam /usr/local/nginx/ssl/dhparam.pem;
  18.         
  19.         #error_page   404   /404.html;

  20.         # Deny access to PHP files in specific directory
  21.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  22.         include enable-php.conf;

  23.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  24.         {
  25.             expires      30d;
  26.         }

  27.         location ~ .*\.(js|css)?$
  28.         {
  29.             expires      12h;
  30.         }

  31.         location ~ /.well-known {
  32.             allow all;
  33.         }

  34.         location ~ /\.
  35.         {
  36.             deny all;
  37.         }

  38.         access_log  /home/wwwlogs/lnmp.log;
  39. }

  40. server
  41.         {
  42.         listen          80;
  43.         server_name xxx.com;
  44.         return 301 https://xxx.com$request_uri;
  45. }
复制代码

[ 本帖最后由 hooky 于 2018-1-30 10:38 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2018-1-30 18:38:30 | 显示全部楼层


看看提示文件第二行是啥,example只改基本信息肯定不会报错
如果不会自己改配置文件,可以直接 lnmp vhost add 或 lnmp ssl add 添加就行了
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-24 17:18 , Processed in 0.025147 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表