LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to work on a website with a domain name pointed somewhere else? (https://www.linuxquestions.org/questions/linux-server-73/how-to-work-on-a-website-with-a-domain-name-pointed-somewhere-else-4175582253/)

AdultFoundry 06-14-2016 11:12 AM

How to work on a website with a domain name pointed somewhere else?
 
I have a website under domain.com and I was trying to move it to a different hosting, but it did not work there. The website is back at host A and I have all the files and the database (at least from yesterday) at host B.

I would like to keep the website running on host A and troubleshoot the website on host B without the domain name pointing to it. I have one IP address for the hosting, and I have several other websites there, based on Apache / VirtualHost definitions like:

<VirtualHost *:80>
Document Root /home/www/html/some-domain.com
ServerName some-domain.com
</VirtualHost>

So the site is in /home/www/html/domain.com, the IP is 121.42.55.01, lets say. How would I get this to display in the browser, so I can troubleshoot the site? Once I point the domain to this IP it starts a big mess, the site does not work / load there and all the other sites are messed up to (slow loading / connecting for a long time, and one does not work at all because of an overload protection - too many MySQL queries, I think).

I know that this should be possible, but how to do it (the easiest and the fastest way). The http://121.42.55.01/~some-name-here thing?

Thanks.

ktask 06-14-2016 06:26 PM

Stealth Mode ...
 
Well, that's what I call it, anyway.

Every laptop/tabletop workstation should have DNS setup such that it checks the local host file before DNS. On a Mac/Linux box, /etc/hosts/.

If, the server being developed has virtual apache setup to respond to the fully qualified domain that hasn't been moved yet, one can use their local host file thusly:

IPaddressOfDevServer sitesfqdn hostname

Example: Real server is at www.somenet.net and it's public IP address is xxx.xxx.xxx.xxx
The development server is at yyy.yyy.yyy.yyy

At the bottom of the hosts file add:

yyy.yyy.yyy.yyy www.somenet.net www

No need to restart anything, just open a browser and point to www.somenet.net

Just one catch 22 ... as long as you have that 'fake' entry in your /etc/hosts file, can only view etc. the dev site. Can't work on the real site and the 'Stealth' site at the same time.

'spirit of sharing', Ken

TenTenths 06-15-2016 02:10 AM

You may also want to put in an allow/deny block in the vhost config or at firewall level to ensure that only your IP address can connect.

If you're running multiple websites that have multi-table backend databases you may need to increase the open files limit, if you're using MySQL/CentOS there's a link to a good guide on my blog http://centos.tips

Habitual 06-15-2016 06:40 AM

Let's here it for "Poor Mans' DNS". Good stuff that /etc/hosts. ;)
Lock down the "new" site during testing to select IPs:
Code:

<Directory /var/www/html/> # Check this. Yours may differ here.
    Options -Indexes FollowSymLinks MultiViews
    AllowOverride All # Allow .htaccess in apache2.4
    Order deny,allow
    deny from all
    allow from 123.123.123.123 # CIDR masks are valid here also
    allow from another_IP
    allow from yet_another
</Directory>



All times are GMT -5. The time now is 06:22 PM.