Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Jun 06, 2013 9:24 pm 
Offline
Newbie

Joined: Thu Jun 06, 2013 9:20 pm
Posts: 3
I have a Linode server hosting my portfolio. My portfolio was built with Rails 3 and deployed with Nginx and Capistrano. I have a user called deployer and here's my folder structure:

Code:
/home/deployer/apps/portfolio


I want to do something like

Code:
/home/deployer/apps
                   /portfolio
                   /otherapp

Right now I'm using a DNS for rafaelfragoso.com on the DNS tab And my Linode only have one IP address.

What changes do I need to make to host more than one website? Thanks!


Top
   
PostPosted: Thu Jun 06, 2013 10:36 pm 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
If you want to have your Linode respond with different content when it is accessed by a different name (e.g., example.net), you need to set up "name-based virtual hosting." The nginx guides in the Linode library discuss this. You can find additional documentation by searching on that term.


Top
   
PostPosted: Fri Jun 07, 2013 11:59 am 
Offline
Newbie

Joined: Thu Jun 06, 2013 9:20 pm
Posts: 3
Vance wrote:
If you want to have your Linode respond with different content when it is accessed by a different name (e.g., example.net), you need to set up "name-based virtual hosting." The nginx guides in the Linode library discuss this. You can find additional documentation by searching on that term.


I'll take a look.


Top
   
PostPosted: Wed Jun 26, 2013 12:58 pm 
Offline
Senior Member
User avatar

Joined: Wed Jun 26, 2013 1:53 am
Posts: 118
Create a file under /etc/apache2/sites-available for each website you want. You could name the files by the domain, such as web1.example.com.

Add the following to the file, with the information changed for your website:

Code:
<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin webmaster@example.com
  ServerName  www.example.com
  ServerAlias example.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /home/example_user/public/example.com/public

  # Log file locations
  LogLevel warn
  ErrorLog  /home/example_user/public/example.com/log/error.log
  CustomLog /home/example_user/public/example.com/log/access.log combined
</VirtualHost>


Then run
Code:
sudo a2ensite web1.example.com


and then
Code:
sudo service apache2 restart


Repeat this process for each web server directory and website you want to create.

_________________
Homepage www.sturmkrieg.com
Social network Gamernet
Development website Sashaweb Development
Imageboard img.sturmkrieg.com
WikiHub free wiki host Community Wiki


Top
   
PostPosted: Wed Jun 26, 2013 1:26 pm 
Offline
Newbie

Joined: Thu Jun 06, 2013 9:20 pm
Posts: 3
I'm using Nginx as my web server.

I have the Linode's IP address and I have my domain (rafaelfragoso.com). I have my domain configured with nginx and passenger and everything works just fine. Now that I don't need the Linode's ip address to access my website, I want to use it for a different project like this:

Code:
/home/deployer/apps/rafaelfragoso.com/ (rafaelfragoso.com)
/home/deployer/apps/beta/ (xx.xx.xx.xx Linode's ip)


How can I accomplish that?

PS: I'm not using the sites-enabled/sites-available folders.


Top
   
PostPosted: Sun Jun 30, 2013 10:57 am 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
rafaelfragosom wrote:
I'm using Nginx as my web server.

I have the Linode's IP address and I have my domain (rafaelfragoso.com). I have my domain configured with nginx and passenger and everything works just fine. Now that I don't need the Linode's ip address to access my website, I want to use it for a different project like this:

Code:
/home/deployer/apps/rafaelfragoso.com/ (rafaelfragoso.com)
/home/deployer/apps/beta/ (xx.xx.xx.xx Linode's ip)


How can I accomplish that?

PS: I'm not using the sites-enabled/sites-available folders.


That can be accomplished by setting up a virtual host in Nginx, setting the server_name to your Linode's IP address. You'd then set the root to /home/deployer/apps/beta (or whatever you want to serve via the IP). I actually use that trick at home due to a bug in my router -- I have remote management disabled, but it still displays the remote management page UNLESS I forward connections to my home server to give people a "Quit Spying On Me!" message :wink:

EDIT: Personally I think using sites-available/sites-enabled keeps things more organized, it makes it easier to enable/disable virtual hosts without deleting or moving them. Just my 1 cent.

_________________
Kris the Piki Geeker


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group