我原本在用8080
端口,但是今天將端口改成80
之後,瀏覽器可以直接打開localhost
#,並且正確顯示裡面的目錄,網址列也顯示localhost
。
之前搭建了一個wordpress本地博客,於是點擊目錄wordpress的目錄,發現無法進入,地址欄顯示localhost:8080/wordpress
,無論手動改成localhost/wordpress
還是localhost:80/wordpress
都會自動轉到localhost:8080/wordpress
。
已經確定和瀏覽器快取無關,試過用chrome和safari清理所有瀏覽記錄後再訪問,情況依舊。
nginx設定檔
worker_processes 1;
error_log /usr/local/var/log/nginx/error.log debug;
pid /usr/local/var/run/nginx.pid;
events {
worker_connections 256;
}
http {
include 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 /usr/local/var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
try_files $uri $uri/ /index.php$uri /index.php?$args;
root /usr/local/var/www;
location / {
root /usr/local/var/www;
index index.php index.html index.htm;
#try_files $uri $uri/ /index.php$uri;
#try_files $uri $uri/ /index.html;
try_files $uri $uri/ =404;
fastcgi_param script_filename $document_root$fastcgi_script_name;
}
include php.conf; //这个是PHP的配置文件,应该不用了吧……
}
include servers/*;
include /usr/local/etc/nginx/sites-enabled/*;
autoindex on;
autoindex_exact_size off;
}