服务器上现有一个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呢?难道是域名被劫持了?