Rumah > Soal Jawab > teks badan
Terdapat laman web php pada pelayan, yang boleh diakses secara normal Sekarang kita perlu menambah laman web statik Selepas mengkonfigurasi hos maya, ia tidak boleh diakses...
nginx.conf fail konfigurasi:
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;
}
Fail konfigurasi projek php asal:
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;
}
}
Konfigurasi pengehosan web baharu:
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;
}
}
Nama domain boleh berjaya diping, dan alamat IP adalah betul Periksa log ralat dan ia akan kelihatan seperti ini:
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"
Alamat IP komputer yang saya gunakan penyemak imbas untuk mengakses ialah 117.184.149.210, tetapi mengapa nombor klien dalam log ralat 9, 12 dan 13: 42.156.138.69? Mungkinkah nama domain itu telah dirampas?
迷茫2017-05-16 17:11:09
Selesai Ini bukan masalah konfigurasi pelayan Pembekal perkhidmatan mempunyai mekanisme penapisan Anda perlu menambah senarai putih nama domain untuk akses biasa. terima kasih!
大家讲道理2017-05-16 17:11:09
Saya tidak mendapati anda menghadapi sebarang masalah.
Abaikan yang mengakses down.asp. Internet sangat besar, akan sentiasa ada beberapa pengimbas di mana-mana.
PHP中文网2017-05-16 17:11:09
Idea pertama ialah menyemak sumbernya dan kekerapan panggilan. Jika masalah ini kerap berlaku, mungkin ada robot reptilia yang merangkak data.
阿神2017-05-16 17:11:09
Anda tidak pernah melihat iklan sekecil itu menggunakan perangkak. Abaikan saja.