Question
Local server with domain name setup on host file redirects to the digitalocean server
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
- main site: www.website.com
- beta site: beta.website.com IP is setup by digitalocean
Development server is in a VM (VMWare) from the development HQ supporting for 3 network interfaces:
- eth0 - NAT network
- eth1 - Host-only Network
- eth3 - Bridge adapter
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;
}
}
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
Have you also added
192.168.1.100 develop.website.com
to the host file of the development server?It shouldn’t be doing anything, just by added PHP to Nginx. That’s weird.
But if you add WordPress, it has many places where it does redirects.
Hi, thank you for the response, we have a snapshot where Wordpress isn’t installed yet and it still redirects. I create a file called info.php, it contains the following:
still redirect’s. It is weird because it shouldn’t do that.