首頁  >  問答  >  主體

OSX nginx 改變了listen連接埠後,點擊裡面的目錄還是跳到原來的連接埠?

我原本在用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;
}
曾经蜡笔没有小新曾经蜡笔没有小新2736 天前404

全部回覆(1)我來回復

  • 为情所困

    为情所困2017-05-16 17:20:18

    請貼上你的配置

    回覆
    0
  • 取消回覆