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. 可以链接不同源的资源的html元素(能实现跨域)

    可以链接不同源的资源的html元素(能实现跨域): img.script.css.video.audio.object.embed.applet.@font-face.frame.iframe等. ( ...

  2. [nginx] connect() failed (111: Connection refused) while connecting to upstream, client: 101.18.123.107, server: localhost,

    nginx一直报错, 2016/12/02 10:23:19 [error] 1472#0: *31 connect() failed (111: Connection refused)while c ...

  3. (转)php-curl响应慢(开发微信授权登陆时碰到的问题)

    最近在做一个php小项目的时候,发现curl调用微信的授权api.weixin.qq.com,经常是需要等待很久,但是有时候却很快. 刚开始以为是网络慢问题,没去注意.后面通过打上时间日志观察发现,慢 ...

  4. Mybatis原理分析之二:框架整体设计

    1.引言 本文主要讲解Mybatis的整体程序设计,理清楚框架的主要脉络.后面文章我们再详细讲解各个组件. 2.整体设计 2.1 总体流程 (1)加载配置并初始化       触发条件:加载配置文件 ...

  5. Android生命周期

    Android的生命周期如下图所示: A和B两个Activity,从A启动B活动.执行的方法: A活动 onCreate() onStart() onResume()                 ...

  6. Linux系统的压缩技术

    1.常见的压缩文件扩展名 *.Z ---> compress程序压缩的文件. *.gz --->gzip 程序压缩的文件: *.bz2------>bzip2程序压缩的文件: *.t ...

  7. 怎么打开sql server 数据库日志文件

    To Open Log File Viewer, 1. Expand Server Node > 2. Expand SQL Server Agent > 3. Expand Jobs & ...

  8. c++ 使用shell命令

    #include <iostream> #include <stdio.h> #include <vector> #include <unistd.h> ...

  9. ZOJ 1958. Friends

    题目链接: ZOJ 1958. Friends 题目简介: (1)题目中的集合由 A-Z 的大写字母组成,例如 "{ABC}" 的字符串表示 A,B,C 组成的集合. (2)用运算 ...

  10. View Controller Relationships

    Parent-child relationshipsParent-child relationships are formed when using view controller container ...