By MarkHeramis
Me and my team are trying to setup a local development central server for office use and ease access to development server, we are using a **VMware **to host an Ubuntu 16.04 server which will be used as a central testing server for the development team. The setup looks like the following:
Production server is hosted in **DigitalOcean **(of course) with 2 vhost configured in nginx
Development server is in a VM (VMWare) from the development HQ supporting for 3 network interfaces:
We are in the process of setting up local DNS server right now, but our current solution should have worked.
Our current solution is as follows: We have manually configured all our computer’s Host File with the following entry
192.168.1.100 develop.website.com
192.168.1.100 is the IP address from eth3 which is configured as a static IP address setup by the network router. If we try to ping the server via the provided domain develop.website.com we get the expected result.
$ ping develop.website.com
Pinging develop.website.com [192.168.1.100] with 32 bytes of data:
Reply from 192.168.1.100: bytes=32 time<1ms TTL=64
Reply from 192.168.1.100: bytes=32 time<1ms TTL=64
Reply from 192.168.1.100: bytes=32 time<1ms TTL=64
Reply from 192.168.1.100: bytes=32 time<1ms TTL=64
upon installation of nginx we tried to do an HTTP request on the server using develop.website.com and got what we expected “The default page of Nginx” but when we started configuring the using the steps from How To Install WordPress with LEMP on Ubuntu 16.04 Guide to enable PHP support and tried to request again, it redirects us to beta.website.com which is the production server. We do not understand why this is happening. The vanila nginx function as expected but the PHP configured nginx redirect us to production server.
The nginx configuration is as follows
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /home/master/www;
index index.php index.html index.htm;
server_name develop.website.com;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
The only issue I can see with the server block you’ve provided is the default location block for /. By default, that’s going to result in 404’s.
location / {
try_files $uri $uri/ =404;
}
The above is essentially saying that if the requested location doesn’t exist (file or directory), return a 404.
Since permalinks follow a directory-like structure, the paths in the URL will never actually resolve to a real directory or file, so the result would be a 404.
I would recommend changing that to:
location / {
try_files $uri $uri/ /index.php?$args;
}
I also recommend using a slightly modified location block for PHP-FPM by changing:
location ~ \.php$ {
to
location ~ [^/]\.php(/|$) {
You’ll need to reload or restart NGINX for those changes to take effect once saved.
Beyond the above changes, are there any other server blocks active and can you post your NGINX configuration file?
cat /etc/nginx/nginx.conf
There’s nothing in that server block that should be causing a redirect, so we need to look elsewhere. I would also recommend checking the log files to see if there’s anything popping up there.
tail -20 /var/log/nginx/error.log
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.