• 1.mysql
    In my wordpress the guid is the form of https://127.0.0.1/wp/?p=1931 .

    select guid  from wp_posts limit 1 ;
    +--------------------------+
    | guid                     |
    +--------------------------+
    | https://127.0.0.1/wp/?p=4 |
    +--------------------------+

    2.wordpress

    cat   /var/www/html/wp/wp-config.php
    define('WP_SITEURL','https://localhost:8080/wp/');
    define('WP_HOME','https://localhost:8080/wp/');

    3.nginx

    cat  /etc/nginx/nginx.conf
    server {
        listen 8080;
        server_name localhost;
        index index.html index.htm index.php;
        root /var/www/html;
    location / {
            try_files $uri $uri/ /index.html;
        }
    
        error_page 404 /404.html;
    
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
            root /usr/share/nginx/html;
        }
    
        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    }

    My wordpress can be visited to input url in the form of https://127.0.0.1:8080/wp/ or https://127.0.0.1:8080/wp/?p=1938. Now i want to change the port from 8080 into 80.

    1.to edit /var/www/html/wp/wp-config.php

    from

    define('WP_SITEURL','https://localhost:8080/wp/');
    define('WP_HOME','https://localhost:8080/wp/');

    into

    define('WP_SITEURL','https://localhost/wp/');
    define('WP_HOME','https://localhost/wp/');

    2.to edit /etc/nginx/nginx.conf

    from

    server {
        listen 8080;
    
    into
    
    server {
        listen 80;
    
    restart nginx.

    The wordpress can’t be visited When to input https://127.0.0.1/wp/ in chrome.

    If i delete the two lines in the /var/www/html/wp/wp-config.php.

    define('WP_SITEURL','https://localhost/wp/');
    define('WP_HOME','https://localhost/wp/');

    The url will jump to https://127.0.0.1:8080/wp/ when to input https://127.0.0.1/wp/ in chrome.

  • The topic ‘why can't change nginx port from 8080 into 80?’ is closed to new replies.