• I’m trying to move a wordpress instalation to a new server.

    The old server (development server) had a different domain and a common LAMP stack. In this new server I added an SSL certificate installed nginx instead of APACHE, put PHP7 instead of PHP5 and changed the domain.

    I used interconnect/it to change all urls on the database.

    The landing page and wp-admin work as expected. But all other links show a nginx not found page.

    The error log shows the following:

    2016/05/17 10:38:22 [error] 29722#29722: *1 FastCGI sent in stderr: "PHP message: header-1
    PHP message: !empty(page_id)90px
    PHP message: header-1
    PHP message: !empty(page_id)90px" while reading response header from upstream, client: 0.0.0.0, server: host, request: "GET /wp/?custom-pag$

    My Nginx configuration:

    server {
        listen 80;
        location / {
            return 301 https://$host$request_uri;
        }
    }
    server {
        server_name www.host.com hostcom;
        listen 443 ssl http2 default_server;
        port_in_redirect off;
        access_log   /var/log/nginx/host.com.access.log;
        error_log    /var/log/nginx/host.com.error.log;
    
        root  /path/to/root;
        index index.php index.html index.htm;
    
        [SSL configuration]
        resolver 127.0.0.1;
    
        location / {
            try_files $uri $uri/ /index.php?$args;
        }
    
        # Cache static files for as long as possible
        location ~*.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|cur)$ {
                expires max;
                log_not_found off;
                access_log off;
        }
    
        # Deny public access to wp-config.php
        location ~* wp-config.php {
            deny all;
        }
    
        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php7-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    
    }

    What I’m I doing wrong?

    Thank you.

  • The topic ‘How to migrate Apache to Nginx in a new server with new domain?’ is closed to new replies.