Home  >  Q&A  >  body text

After changing the listening port of OSX nginx, do you click on the directory inside or jump to the original port?

I was originally using the 8080 port, but after changing the port to 80 today, the browser can directly open localhost and correctly display the directories inside. , the address bar also displays localhost.
I built a local wordpress blog before, so I clicked on the directory of the wordpress directory and found that I could not enter it. The address bar showed localhost:8080/wordpress, regardless of whether it was manually changed to localhost/wordpress Or localhost:80/wordpress will automatically go to localhost:8080/wordpress.

It has been determined that it has nothing to do with the browser cache. I have tried clearing all browsing history with Chrome and Safari before visiting again, but the situation remains the same.

nginx configuration file

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;
}
曾经蜡笔没有小新曾经蜡笔没有小新2688 days ago350

reply all(1)I'll reply

  • 为情所困

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

    Please post your configuration

    reply
    0
  • Cancelreply