Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2006
    Posts
    503

    Site preview on Nginx

    Hello

    On apache I used to to this to load a preview of each site using the IP address:

    Code:
    <VirtualHost my.ip.addre.ss:80>
       ServerName www.mysite.com
       ServerAlias mysite.com
       DocumentRoot /var/www/sites/mysite.com
           <Directory "/var/www/sites/mysite.com">
                   Options FollowSymLinks -Includes
                   AllowOverride All
                   Order allow,deny
                   Allow from all
           </Directory>
           RewriteEngine on
    </VirtualHost>
    
    Alias /mysite.com  /var/www/sites/mysite.com
    The result was having each site loading using: http://IP/mysite.com

    I need to replicate that same usage for Nginx with many virtual hosts. Does anyone know how to do it?

    Thanks

  2. #2

    Nginx

    Quote Originally Posted by sh4ka View Post
    Hello

    On apache I used to to this to load a preview of each site using the IP address:

    Code:
    <VirtualHost my.ip.addre.ss:80>
       ServerName www.mysite.com
       ServerAlias mysite.com
       DocumentRoot /var/www/sites/mysite.com
           <Directory "/var/www/sites/mysite.com">
                   Options FollowSymLinks -Includes
                   AllowOverride All
                   Order allow,deny
                   Allow from all
           </Directory>
           RewriteEngine on
    </VirtualHost>
    
    Alias /mysite.com  /var/www/sites/mysite.com
    The result was having each site loading using: http://IP/mysite.com

    I need to replicate that same usage for Nginx with many virtual hosts. Does anyone know how to do it?

    Thanks
    One way you can do is using different ports:

    Site1:

    server {
    listen 80;
    server_name localhost;

    location / {
    root /var/www/site1;
    }
    }

    Site2:

    server {
    listen 81;
    server_name localhost;

    location / {
    root /var/www/site2;
    }
    }

  3. #3
    You can try with the following

    Code:
    server {
      server_name YOUR_IP;
      # -- code -- #
    
      location /sub_1 {
        root /var/www/sub_1;
      }
    
      location /sub_2 {
        root /var/www/sub_2;
      }
    
      location /sub_3 {
        root /var/www/sub_3;
      }
    
      # -- code -- #
    }
    ---=== RoseHosting.com Admin ===---
    Linux Cloud Hosting - linuxcloudvps.com
    Linux VPS Hosting - rosehosting.com
    High Quality Linux virtual servers with lots of Guaranteed RAM and HDD space, Impeccable Service.

Similar Threads

  1. site preview not loading
    By Mike006 in forum Hosting Security and Technology
    Replies: 1
    Last Post: 04-19-2005, 12:49 AM
  2. Site preview. C&C please
    By DimitryVC in forum Web Site Reviews
    Replies: 20
    Last Post: 02-05-2004, 04:24 PM
  3. New Site Preview - Comments Please
    By Vortex-Steve in forum Web Site Reviews
    Replies: 12
    Last Post: 08-23-2003, 06:42 AM
  4. Offline site preview
    By MGCJerry in forum Web Site Reviews
    Replies: 7
    Last Post: 01-31-2002, 05:40 AM
  5. personal site layout preview. thoughts?
    By druber in forum Web Site Reviews
    Replies: 1
    Last Post: 06-27-2001, 02:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •