26
loading...
This website collects cookies to deliver better user experience
[ec2-user@ip-999-99-99-99 ~]$ cd /etc/httpd/conf.d
[ec2-user@ip-999-99-99-99 ~]$ sudo nano vhosts.conf
<VirtualHost *:80>
# The name your website should respond to
ServerName foo.com
# Tell Apache where your document root is
DocumentRoot /var/www/html/foo.com
# Add this line if you are allowing .htaccess overrides.
<Directory /var/www/html/foo.com>
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:80>
# The name your website should respond to
ServerName bar.com
# Tell Apache where your document root is
DocumentRoot /var/www/html/bar.com
# Add this line if you are allowing .htaccess overrides.
<Directory /var/www/html/bar.com>
AllowOverride All
</Directory>
</VirtualHost>
[ec2-user@ip-999-99-99-99 conf.d]$ sudo service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[ec2-user@ip-999-99-99-99 conf.d]$
[ec2-user@ip-999-99-99-99 conf.d]$ echo '<h1>Hello World</h1>' > /var/www/html/foo.com/index.html
Tims-MacBook-Pro:~ tim$ sudo nano /etc/hosts
* added to the end of the file *
999.99.99.99 foo.com
26