nginx增加了新的server name配置,发现nginx -s reload之后总是不生效。

http和https均可以打开页面,但是页面是别的server页面,使用的证书也是别的server的证书。

新加的配置文件如下

server {
listen 80;
server_name img31.test.com;
access_log /home/test/logs/accesslog/img31.test.com/img31.test.com_access.log main;
location / {
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Test-CDN-Proxy-Origin-Host cdn.m.test.cn;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
index index.html index.htm;
proxy_pass http://img31.test.com;
}
error_page 404 500 502 503 504 = http://www.test.com/404.html;
} server {
listen 443;
server_name img31.test.com;
access_log /home/test/logs/accesslog/img31.test.com/img31.test.com_access.log main;
ssl on;
ssi_types text/shtml;
ssl_certificate crt/test-server.crt;
ssl_certificate_key crt/test-server.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Test-CDN-Proxy-Origin-Host cdn.m.test.cn;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
index index.html index.htm;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://img31.test.com;
}
error_page 404 500 502 503 504 = http://www.test.com/404.html;
}

最后想起来用nginx -t才发现配置中的log输出目录还没有创建,mkdir后问题解决。

配置不生效时,打开了其他server的80端口和443端口

改得多了,有时就忽略了nginx -t这一步,会忽略掉一些常见的小问题。

nginx修改配置后不生效的问题的更多相关文章

  1. 【Linux】Linux修改openfiles后不生效问题?

    #次故障问题环境背景: Centos7.4物理机,升级过ssh和ntp: #一般只需要在此文件后面添加4行就行,配置后即可生效(exit再次登录即可生效),此次配置后没生效,reboot还是没生效,在 ...

  2. 【Linux】宝塔上 GitLab数据迁移修改配置后nginx无法启动

    背景: 服务器A 向 服务器B 迁移数据,修改配置重启.发现gitlab的 nginx 无法启动. 查找原因 gitlab-ctl tail 错误信息: 网上查了查,似乎是宝塔的问题, 原因应该是为了 ...

  3. nginx https配置后无法访问,可能防火墙在捣鬼

    同事发现nginx配置后https 无法访问,我帮忙解决的时候从以下出发点 1.防火墙未开放443端口 2.配置出错 1 2 3 于是就 netstat -anp 查看防火墙开的端口 发现已经在监听了 ...

  4. nginx+php-fpm配置后页面显示空白的解决方法以及用nginx和php-fpm解决“502 Bad Gateway”问题

    For reference, I am attaching my location block for catching files with the .php extension: location ...

  5. Sentinel控制台1.8.3修改源码,修改配置后推送到Nacos

    目录 1. 接着上一篇 2. 思路 3. 下载Sentinel源码 4. 看Gateway里面读取的配置信息 5. 修改Sentinel控制台源码 6. 熔断规则测试 7. 限流规则测试 8. 打包使 ...

  6. Windows IIS 集成PHP时修改PHP.ini 配置后不生效问题

    iis下修改c://windows/php.ini 重启iis的网站不生效.需要重启应用程序池即可生效.

  7. Nginx修改配置实现图片防盗链

    一般情况下,防盗链是针对软件下载和图片的,由于一般的站点不提供资源下载,所以本文主要是针对图片的防盗链 1.如果对全站图片做防盗链,至少需要一个另外的域名存放指向图片.因为如果对全站图片做了防盗链,包 ...

  8. [转][CentOS]修改IP后立即生效

    来自:http://bbs.51cto.com/thread-789908-1.html Linux系统里修改IP地址后该如何使之即刻生效,有两种方法可以解决: (1) sudo ifdown eth ...

  9. nginx+php-fpm配置后页面显示空白的解决方法(yum形式的安装)

    OS: Ubuntu 15.04 由于nginx与php-fpm之间的一个小bug,会导致这样的现象: 网站中的静态页面 *.html 都能正常访问,而 *.php 文件虽然会返回200状态码, 但实 ...

随机推荐

  1. C#调试心经续(转)

    断点篇 命中次数(Hit Counts) 右击断点,可以设置Hit Counts(命中次数),会弹出如下的对话框 当条件满足的时候断点会被命中(即即将被执行),这个命中次数是断点被命中的次数.默认是始 ...

  2. About SSDT BI

    Welcome to Microsoft Marketing Speak hell. With the 2012 release of SQL Server, the BIDS, Business I ...

  3. [delphi]向ImageList中加入png类型的资源图片

    向ImageList中动态加入Png图片有些失真,经过多方查询,发现需要将Bitmap的AlphaFormat指定一下. //向ImageList中加入png类型的资源图片 procedure Add ...

  4. OpenStack部署工具总结

    目前感觉比较简单直观的部署工具有RDO.devstack.Fuel等: 1. RDO https://openstack.redhat.com/Quickstart REDHAT出品,支持Redhat ...

  5. [LeetCode] 10. Regular Expression Matching

    Implement regular expression matching with support for '.' and '*'. DP: public class Solution { publ ...

  6. 工具04_SQL Trace/DBMS_SYSTEM

    2014-06-25 Created By BaoXinjian

  7. DevExpress TreeList 全选和反选 z

    /// <summary> /// 全选树 /// </summary> /// <param name="tree">树控件</para ...

  8. CentOS7:安装Zabbix

    参考:CentOS 7 yum安装Zabbix 1. 安装Zabbix Server EPEL源里面有Zabbix的安装包,所以需要先安装EPEL. Zabbix源也可以从这里获得:http://re ...

  9. CryptoJS遇到的小坑

    CryptoJs是前端加密用的,具体介绍:http://code.google.com/p/crypto-js/ 对应国内免费CDN 服务:http://www.bootcdn.cn/crypto-j ...

  10. 深入理解Oracle的并行操作-转载

    转载:http://czmmiao.iteye.com/blog/1487568 并行(Parallel)和OLAP系统 并行的实现机制是:首先,Oracle会创建一个进程用于协调并行服务进程之间的信 ...