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;
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM