Home  >  Q&A  >  body text

centos7 - nginx server configuration problem

There is a php website on the server, which can be accessed normally. Now we need to add a static site. After configuring the virtual host, it cannot be accessed...

nginx.conf configuration file:

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

Original php project configuration file:

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

New virtual host configuration:

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

The ping domain name can be pinged successfully, and the IP address is correct. Check the error log and it will look like this:

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"

The IP address of the computer I use the browser to access is 117.184.149.210, but why are the client errors in logs 9, 12, and 13: 42.156.138.69? Could it be that the domain name has been hijacked?

某草草某草草2714 days ago460

reply all(6)I'll reply

  • 迷茫

    迷茫2017-05-16 17:11:09

    Solved. It’s not a server configuration problem. The service provider has a filtering mechanism. You need to add a domain name whitelist for normal access! Thank you!

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 17:11:09

    www.dj002.com Where did this come from?

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-16 17:11:09

    I didn’t find that you encountered any problems.

    You should ignore the one accessing down.asp. The Internet is so big, there will always be some scanners everywhere.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 17:11:09

    You didn’t configure php execution?

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 17:11:09

    The first idea is to check the source of it and the frequency of calls. If this problem occurs regularly, there may be a reptile robot crawling the data.

    reply
    0
  • 阿神

    阿神2017-05-16 17:11:09

    You have never seen such small advertisements using crawlers. Just ignore it.

    reply
    0
  • Cancelreply