centos7 - nginx 伺服器設定問題
某草草
某草草 2017-05-16 17:09:09
0
6
498

伺服器上現有一個php網站,可以正常訪問,現在要新增一個靜態站點,配置虛擬主機以後無法訪問…

nginx.conf設定檔:

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    use     epoll;
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    server_names_hash_bucket_size 128;
    client_header_buffer_size 4k;
    large_client_header_buffers 8 128k;
    open_file_cache max=102400 inactive=20s;
    client_max_body_size 1024m;

    proxy_connect_timeout 90;
    proxy_read_timeout 180;
    proxy_send_timeout 180;
    proxy_buffer_size 256k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;
    proxy_temp_file_write_size 256k;
    tcp_nodelay on;
    client_body_buffer_size 512k;
    proxy_intercept_errors on;


    sendfile        on;
    tcp_nopush     on;

    keepalive_timeout  65;

    gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

原先的php專案設定檔:

server {
    listen       80;
    server_name  trmob.com www.trmob.com;
    root /home/www/DynamicWebsite/trmob;
    index index.php default.php index.html index.htm default.html default.htm;
    charset utf-8;
    access_log  /var/log/nginx/log/trmob.access.log  main;

    location ~ .*\.(php|php5)?$ {
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
    }
    location /status {
        stub_status on;
        access_log off;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
        expires      30d;
    }
    location ~ .*\.(js|css)?$ {
        expires      1h;
    }
    location ~* ^/(data|templets|uploads|a|images)/.*\.(php|php5)$
    {
        deny all;
    }
}

新的虛擬主機設定:

server {
   listen       80;
   server_name  9longku.com www.9longku.com;
   charset utf-8;
   location / {
      root   /home/www/temp/9longku;
      index  index.html index.htm;
   }
   error_page   500 502 503 504  /50x.html;
   location = /50x.html {
      root   html;
   }
}

ping網域可以ping通,IP位址也對,查看錯誤日誌是這樣的:

2017/02/23 22:07:09 [error] 5158#5158: *1 open() "/home/www/DynamicWebsite/trmob/undefined" failed (2: No such file or directory), client: 117.184.149.210, server: trmob.com, request: "GET /undefined HTTP/1.1", host: "www.trmob.com", referrer: "http://www.trmob.com/index.html"
2017/02/23 22:07:20 [error] 5158#5158: *1 open() "/home/www/DynamicWebsite/trmob/undefined" failed (2: No such file or directory), client: 117.184.149.210, server: trmob.com, request: "GET /undefined HTTP/1.1", host: "www.trmob.com", referrer: "http://www.trmob.com/index.html"
2017/02/23 22:11:38 [notice] 5204#5204: signal process started
2017/02/23 22:11:39 [error] 5215#5215: *9 open() "/home/www/temp/9longku/user/do.asp" failed (2: No such file or directory), client: 42.156.138.69, server: 9longku.com, request: "GET /user/do.asp?ac=error&id=3277 HTTP/1.1", host: "www.dj002.com"
2017/02/23 22:16:56 [error] 5215#5215: *12 open() "/home/www/temp/9longku/down.asp" failed (2: No such file or directory), client: 42.156.138.69, server: 9longku.com, request: "GET /down.asp?id=5914 HTTP/1.1", host: "www.dj002.com"
2017/02/23 22:16:57 [error] 5215#5215: *13 open() "/home/www/temp/9longku/down.asp" failed (2: No such file or directory), client: 42.156.137.69, server: 9longku.com, request: "GET /down.asp?id=5918 HTTP/1.1", host: "www.dj002.com"

我用瀏覽器存取的電腦IP是 117.184.149.210,但為什麼錯誤日誌9、12、13的client 是: 42.156.138.69呢?難道是網域被劫持了?

某草草
某草草

全部回覆(6)
迷茫

已解決,不是伺服器設定問題,服務商有個過濾機制,需要新增網域白名單才能正常存取!謝謝各位!

伊谢尔伦

www.dj002.com這是從哪裡蹦出來的?

大家讲道理

沒有發現你遇到了任何問題呀。

那個訪問 down.asp 的你就別管它。網路這麼大,總是會有些掃描器到處亂掃的。

伊谢尔伦

你這個沒配置php執行的?

Ty80

首先思路該是查詢下it來源,呼叫頻率。若此問題規律出現,那沒準有爬蟲類機器人爬數據.

阿神

你是沒看過這種這樣用爬蟲小廣告的。無視即可。

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板