• Hi,
    It seems like I have set up the Nginx sites properly and I am able to go to my main site perfectly. Now I want to copy that site to a dev version to test changes before making them live. I have copied the Mysql database to include _dev in the name. I have copied the server URL to include _dev and copied the WP directories into that location.
    Logically, all should work, but I am getting a redirect_to placed after wp-login.php
    Also, if I am logged into the regular site and enter the _dev URL, it pulls up the regular site instead of _dev.
    I have changed siteurl and home in the dev wp_options table. What am I missing in order to be able to set this up as a completely separate instance (no multisite)?

Viewing 7 replies - 1 through 7 (of 7 total)
  • You have not mentioned that you have created an additional nginx configuration file for the new host. nginx needs to have one configuration file for each host that you want to serve.

    So you will need to clone the config file for example.com and change the server_name directive to example_dev.com and also set the root directive to the path to your _dev install directory.

    After you have created the config file for the dev site, make sure to restart nginx.

    Thread Starter gwslink

    (@gwslink)

    I forgot to mention that. The separate config is in place but I believe that the root directive was left off. Thanks, I didn’t want to commit a server just for that purpose.

    Thread Starter gwslink

    (@gwslink)

    Oops. I have both the server name and root set. One of the posts that I came across said to use the IP in listen, so I did that also. I was also looking at fastcgi as the culprit, but unable to find a solution there. I have this same file in both sites-enabled and sites-available. I have also removed default. Do you see anything funky that I may have missed? Any other suggestions?

    The only differences between that file and the “dev-less” file are a listen set only to 80 and the removal of “_dev” in all applicable lines.

    server {
    listen 192.168.20.5:88;
    server_name gwcompare_dev.gradywhite.com https://www.gwcompare_dev.gradywhite.com;

    root /var/www/gwcompare_dev/public;
    index index.php;

    access_log /var/www/gwcompare_dev/logs/access.log;
    error_log /var/www/gwcompare_dev/logs/error.log;

    location / {
    try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }
    }

    Thread Starter gwslink

    (@gwslink)

    My reason for thinking that it is a WP config setting is that I type in
    https://gwcompare_dev.gradywhite.com
    and it changes to
    https://gwcompare.gradywhite.com/wp-login.php?redirect_to=http%3A%2F%2Fgwcompare.gradywhite.com
    If I take off the redirect and change to _dev, it logs in and then still redirects to the main site. I believe that I may have just talked myself into the correct solution, though. I have the “My Private Site” plugin installed and it, of course, was duplicated into the _dev copy. I am going to disable all plugins at the database level and see if I can access the _dev site. Do you have any experience with that plugin?

    Thread Starter gwslink

    (@gwslink)

    More research revealed the need for RELOCATE to be added to wp-config. Now, when I access the site by IP and port number, it retains the correct site address. After I changed the Site Address, it is working. I had apparently made another change because it is changing back with a refresh. Progress is good, though.

    Glad you got it working, there is often more than one way to skin a cat, but normally it is not necessary to do what you are saying works for you. None of my configs are set up like yours and I don’t have any RELOCATE definitions in wp-configs. Not saying that’s a problem, but it is interesting!

    According to a tech I spoke to recently at Rackspace, specifying an IP in the listen directive was potentially useful in older versions of nginx, but is unnecessary in newer versions(I don’t need to do that on my sites). What version are you running?

    I’m also surprised that the ‘https://’ string in your server_name directive isn’t throwing an error. The server name is not supposed to include the scheme, IIRC.

    Thread Starter gwslink

    (@gwslink)

    NGINX version is 1.10.0 running on Ubuntu 16.04
    Not sure why it works, but it definitely does. I am documenting the settings so that I can copy live to dev since it has changed over the few days that it took to get the dev site up and running. Thanks for the help.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Making Dev Site On Nginx’ is closed to new replies.