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. Beta版本冲刺——day3

    No Bug 031402401鲍亮 031402402曹鑫杰 031402403常松 031402412林淋 031402418汪培侨 031402426许秋鑫 站立式会议 大将回归,基本功能接口也 ...

  2. [IDEA] IDEA 集成PlantUML

    在windows下,idea 集成plantuml:1. 首先安装好 graphviz,官网地址:http://www.graphviz.org/Download..php,下载合适的包即可.wind ...

  3. resizable.js

    (function($){ var boundbar= { html:"<div class=\"boundbar\" style=\"overflow: ...

  4. mybaits中插入到mysql数据库自动返回id主键

    在做电商项目时,做到添加商品时,添加商品涉及到图片表和最小销售单元表,这两个表有商品的id,添加图片和最小销售单元,要先返回产品的id.具体做法如下 <insert id="addPr ...

  5. Troubleshooting a node by using the netapp SP

    Troubleshooting a node by using the SP When you encounter a problem with a node, you can use the SP ...

  6. https 双向证书

    一:服务器端 1.首先需要配置站点的SSl证书 打开Nginx安装目录下conf目录中的nginx.conf文件 找到    # HTTPS server     #     #server {   ...

  7. UIButton的titleLabe setAttributeSting 首次不起作用

    环境xcode7.3 ios9.3 真机模拟器均出现 UIButton的titleLabe setAttributeSting 首次不起作用,之后每一次 都正常,百思不得解,无奈之下改变策略,讲but ...

  8. 04-c#入门(类型转换)

    “无论是什么类型,所有的数据都是一系列的位,即一系列0和1.变量的含义是通过解释这些数据的方式来传达的.”——这句原话是书上翻译的,不过后一句话总感觉理解起来不是很通俗,自己觉得这样理解可能会合适些: ...

  9. Business Unit Lookup in Form

    Just add the below code in lookup() of StringEdit control in Form to get the Business Unit Lookup: p ...

  10. TCP/IP详解 (转)

    TCP/IP详解学习笔记(1)-基本概念 为什么会有TCP/IP协议 在世界上各地,各种各样的电脑运行着各自不同的操作系统为大家服务,这些电脑在表达同一种信息的时候所使用的方法是千差万别.就好像圣经中 ...