Discover Centmin Mod today
Register Now

Domains How do I setup & access two vhosts without domains?

Discussion in 'Install & Upgrades or Pre-Install Questions' started by Afaq, Aug 5, 2015.

  1. Afaq

    Afaq Member

    42
    1
    8
    Aug 5, 2015
    Ratings:
    +2
    Local Time:
    10:26 PM
    I am running an OVH dedicated server and I've gotten an IP from them which I use to access the server. I installed centminmod on it and then it started showing the centminmod welcome page on that IP.

    I want to host two magento websites on this server but currently, I dont want to use the actual domains because the websites are already running from other servers. How can I make two vhosts from each websites and then access these vhosts individually from the IP address so that I can do all the development and testing before directing the actual domains to the OVH server running centminmod?

    Thanks. Any help will be highly appreciated.
     
  2. eva2000

    eva2000 Administrator Staff Member

    28,925
    6,566
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,743
    Local Time:
    3:26 AM
    Nginx 1.13.x
    MariaDB 5.5
    Just setup the domains you want via centmin.sh menu option 2 as outlined at Nginx Vhost & NSD DNS Setup - CentminMod.com LEMP Nginx web stack for CentOS They aren't live unless you edit your domain's DNS to point to centminmod server's IP address so will no interfere with your live domain operation.

    Then edit each domain's vhost file at /usr/local/nginx/conf/conf.d/newdomain.com.conf and /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf (if you set yes to ssl) and add to server_name listing additional domain names you want to test from i.e. test.newdomain.com.

    would change from

    Code:
    server {
      server_name newdomain.com www.newdomain.com;
    to

    Code:
    server {
      server_name newdomain.com www.newdomain.com test.newdomain.com;
    then only update DNS for test.newdomain.com to point to centminmod server's IP address. Then after testing is done and you want to switch live domain to centminmod copy, just update DNS for newdomain.comto point to centminmod server's IP address as well :)

    If you want to preview newdomain.com on new centminmod server without updating DNS, on Windows PC edit your windows HOSTS file at c:\Windows\System32\Drivers\etc\hosts (see guide at Modify your hosts file | Knowledge Center | Rackspace Hosting or install Hostman app HostsMan - abelhadigital.com which can manage the file too and allows easy dns flushing when you make changes to the hosts file.

    c:\Windows\System32\Drivers\etc\hosts contents to preview without DNS update
    Code:
    centminmodserver-ip-address newdomain.com
    to disable preview comment it out and flush dns for your system
    Code:
    #centminmodserver-ip-address newdomain.com
    Hostsman app to flush dns and edit the c:\Windows\System32\Drivers\etc\hosts file

    hostsman-edit.png hostsman-flushdns.png
     
  3. Afaq

    Afaq Member

    42
    1
    8
    Aug 5, 2015
    Ratings:
    +2
    Local Time:
    10:26 PM
    Thanks a lot for your response.

    I followed the host file method and now its working perfectly fine. Opening the domains open the index files of their respective directories.

    However, I think there might be one issue. Opening the IP still opens the centminmod welcome page. Should not that be hidden or something?
     
  4. Afaq

    Afaq Member

    42
    1
    8
    Aug 5, 2015
    Ratings:
    +2
    Local Time:
    10:26 PM
    I've one more question. I cant seem to access by database. I tried the Heidi tool you've mentioned in the documentation and entered the MySQL root id and pass but it always gives an error.

    [​IMG]
     
  5. eva2000

    eva2000 Administrator Staff Member

    28,925
    6,566
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,743
    Local Time:
    3:26 AM
    Nginx 1.13.x
    MariaDB 5.5
    no that is correct operation you can edit that /usr/local/nginx/html/index.html for main hostname/ip index page to blank page if you want
    You need to grant your local computer's IP address access to MySQL server via mysql grant privileges. If you do not know how, try SSH tunnel method How to connect to a remote MySQL server using HeidiSQL or How to connect and manage your Rackspace Cloud Server locally on your computer | Axertion.com
     
  6. Afaq

    Afaq Member

    42
    1
    8
    Aug 5, 2015
    Ratings:
    +2
    Local Time:
    10:26 PM
    ^^
    That helped. Thanks a lot.

    I've one more question. I copied the magento files in /home/nginx/domains/mydomain.com/public/magento folder and then I tried to access it for installation using mydomain.com/magento url but its giving a 404 error. Its gets redirected to mydomain.com/magento/index.php/install/ but gives a 404 error. Any idea if its a configuration issue or something realated to magento?
     
  7. eva2000

    eva2000 Administrator Staff Member

    28,925
    6,566
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,743
    Local Time:
    3:26 AM
    Nginx 1.13.x
    MariaDB 5.5