nginx重新安装 引起的问题

问题描述:

  今天开发测试环境的网站需要做https认证,默认安装的nginx没有 http_ssl_module 模块,需要重新加载nginx  安装  http_ssl_module ,我采用的是默认的安装脚本重新安装了一个新的 结果安装好后  在本地绑定hosts域名后访问是正常的页面  但是在外面的代理服务器上访问是nginx的默认访问页面。

经过分析得知  

  是由于新安装的nginx的nginx.conf页面是默认的 ,里面有这么一段和我自己定义的server_name 起了冲突,nginx服务默认读取的是nginx.conf里面的配置,所以导致了代理服务器上显示的访问页面是默认的nginx访问页面。

  

server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
}

 

 

解决方法

  从新定义nginx.conf 文件  内容如下:

user root ;
worker_processes auto;
worker_cpu_affinity auto;
#crit
error_log /tmp/nginx_error.log crit;

pid /usr/local/nginx/nginx.pid;

worker_rlimit_nofile 51200;
events
{
use epoll;
worker_connections 1024;
}

http {
access_log /tmp/nginx_access.log;
error_log /tmp/nginx_error.log;
include mime.types;
default_type application/octet-stream;

charset UTF-8;
server_names_hash_bucket_size 128;
client_header_buffer_size 512k;
large_client_header_buffers 4 512k;
client_max_body_size 20m;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
tcp_nodelay on;

include /usr/local/nginx/conf.d/*.conf;
}

原文地址:https://www.cnblogs.com/pyng/p/9806417.html