How To Set Up second Apache Virtual Hosts on Ubuntu
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
0
down vote
favorite
I have one virtual host but when i make second one and going to check ping its goes to first one website, and when check in browser its says 404 not found, but first one works fine.
14.04 xubuntu virtualhost
 |Â
show 3 more comments
up vote
0
down vote
favorite
I have one virtual host but when i make second one and going to check ping its goes to first one website, and when check in browser its says 404 not found, but first one works fine.
14.04 xubuntu virtualhost
Please, share configuration for both virtualhosts
â Dexter Morganov
Feb 28 at 7:18
in /var/www/html/ there are two virtual host example.com and example1.com then /public_html then my folder. and in /etc/apache2/sites-available/example.com.conf
â Anirban Ghosh
Feb 28 at 7:21
and in /etc/apache2/sites-available/example.com.conf <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example.com/public_html serverAlias www.example.com Alias /phpmyadmin "/usr/share/phpmyadmin/" <Directory "/usr/share/phpmyadmin/"> Order allow,deny Allow from all Require all granted </Directory> ErrorLog $APACHE_LOG_DIR/error.log CustomLog $APACHE_LOG_DIR/access.log combined </VirtualHost>
â Anirban Ghosh
Feb 28 at 7:25
and second one /etc/apache2/sites-available/example1.com.conf <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example1.com/public_html serverAlias www.example1.com Alias /phpmyadmin "/usr/share/phpmyadmin/" <Directory "/usr/share/phpmyadmin/"> Order allow,deny Allow from all Require all granted </Directory> ErrorLog $APACHE_LOG_DIR/error.log CustomLog $APACHE_LOG_DIR/access.log combined </VirtualHost>
â Anirban Ghosh
Feb 28 at 7:26
It's not a good idea to use more then 1 DEFAULT virtual host: VirtualHost *:80
â Dexter Morganov
Feb 28 at 7:41
 |Â
show 3 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have one virtual host but when i make second one and going to check ping its goes to first one website, and when check in browser its says 404 not found, but first one works fine.
14.04 xubuntu virtualhost
I have one virtual host but when i make second one and going to check ping its goes to first one website, and when check in browser its says 404 not found, but first one works fine.
14.04 xubuntu virtualhost
14.04 xubuntu virtualhost
asked Feb 28 at 7:09
![](https://lh3.googleusercontent.com/-VUHG-9xKJlY/AAAAAAAAAAI/AAAAAAAAAW8/OVkbSh1EtBg/photo.jpg?sz=32)
![](https://lh3.googleusercontent.com/-VUHG-9xKJlY/AAAAAAAAAAI/AAAAAAAAAW8/OVkbSh1EtBg/photo.jpg?sz=32)
Anirban Ghosh
52
52
Please, share configuration for both virtualhosts
â Dexter Morganov
Feb 28 at 7:18
in /var/www/html/ there are two virtual host example.com and example1.com then /public_html then my folder. and in /etc/apache2/sites-available/example.com.conf
â Anirban Ghosh
Feb 28 at 7:21
and in /etc/apache2/sites-available/example.com.conf <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example.com/public_html serverAlias www.example.com Alias /phpmyadmin "/usr/share/phpmyadmin/" <Directory "/usr/share/phpmyadmin/"> Order allow,deny Allow from all Require all granted </Directory> ErrorLog $APACHE_LOG_DIR/error.log CustomLog $APACHE_LOG_DIR/access.log combined </VirtualHost>
â Anirban Ghosh
Feb 28 at 7:25
and second one /etc/apache2/sites-available/example1.com.conf <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example1.com/public_html serverAlias www.example1.com Alias /phpmyadmin "/usr/share/phpmyadmin/" <Directory "/usr/share/phpmyadmin/"> Order allow,deny Allow from all Require all granted </Directory> ErrorLog $APACHE_LOG_DIR/error.log CustomLog $APACHE_LOG_DIR/access.log combined </VirtualHost>
â Anirban Ghosh
Feb 28 at 7:26
It's not a good idea to use more then 1 DEFAULT virtual host: VirtualHost *:80
â Dexter Morganov
Feb 28 at 7:41
 |Â
show 3 more comments
Please, share configuration for both virtualhosts
â Dexter Morganov
Feb 28 at 7:18
in /var/www/html/ there are two virtual host example.com and example1.com then /public_html then my folder. and in /etc/apache2/sites-available/example.com.conf
â Anirban Ghosh
Feb 28 at 7:21
and in /etc/apache2/sites-available/example.com.conf <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example.com/public_html serverAlias www.example.com Alias /phpmyadmin "/usr/share/phpmyadmin/" <Directory "/usr/share/phpmyadmin/"> Order allow,deny Allow from all Require all granted </Directory> ErrorLog $APACHE_LOG_DIR/error.log CustomLog $APACHE_LOG_DIR/access.log combined </VirtualHost>
â Anirban Ghosh
Feb 28 at 7:25
and second one /etc/apache2/sites-available/example1.com.conf <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example1.com/public_html serverAlias www.example1.com Alias /phpmyadmin "/usr/share/phpmyadmin/" <Directory "/usr/share/phpmyadmin/"> Order allow,deny Allow from all Require all granted </Directory> ErrorLog $APACHE_LOG_DIR/error.log CustomLog $APACHE_LOG_DIR/access.log combined </VirtualHost>
â Anirban Ghosh
Feb 28 at 7:26
It's not a good idea to use more then 1 DEFAULT virtual host: VirtualHost *:80
â Dexter Morganov
Feb 28 at 7:41
Please, share configuration for both virtualhosts
â Dexter Morganov
Feb 28 at 7:18
Please, share configuration for both virtualhosts
â Dexter Morganov
Feb 28 at 7:18
in /var/www/html/ there are two virtual host example.com and example1.com then /public_html then my folder. and in /etc/apache2/sites-available/example.com.conf
â Anirban Ghosh
Feb 28 at 7:21
in /var/www/html/ there are two virtual host example.com and example1.com then /public_html then my folder. and in /etc/apache2/sites-available/example.com.conf
â Anirban Ghosh
Feb 28 at 7:21
and in /etc/apache2/sites-available/example.com.conf <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example.com/public_html serverAlias www.example.com Alias /phpmyadmin "/usr/share/phpmyadmin/" <Directory "/usr/share/phpmyadmin/"> Order allow,deny Allow from all Require all granted </Directory> ErrorLog $APACHE_LOG_DIR/error.log CustomLog $APACHE_LOG_DIR/access.log combined </VirtualHost>
â Anirban Ghosh
Feb 28 at 7:25
and in /etc/apache2/sites-available/example.com.conf <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example.com/public_html serverAlias www.example.com Alias /phpmyadmin "/usr/share/phpmyadmin/" <Directory "/usr/share/phpmyadmin/"> Order allow,deny Allow from all Require all granted </Directory> ErrorLog $APACHE_LOG_DIR/error.log CustomLog $APACHE_LOG_DIR/access.log combined </VirtualHost>
â Anirban Ghosh
Feb 28 at 7:25
and second one /etc/apache2/sites-available/example1.com.conf <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example1.com/public_html serverAlias www.example1.com Alias /phpmyadmin "/usr/share/phpmyadmin/" <Directory "/usr/share/phpmyadmin/"> Order allow,deny Allow from all Require all granted </Directory> ErrorLog $APACHE_LOG_DIR/error.log CustomLog $APACHE_LOG_DIR/access.log combined </VirtualHost>
â Anirban Ghosh
Feb 28 at 7:26
and second one /etc/apache2/sites-available/example1.com.conf <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example1.com/public_html serverAlias www.example1.com Alias /phpmyadmin "/usr/share/phpmyadmin/" <Directory "/usr/share/phpmyadmin/"> Order allow,deny Allow from all Require all granted </Directory> ErrorLog $APACHE_LOG_DIR/error.log CustomLog $APACHE_LOG_DIR/access.log combined </VirtualHost>
â Anirban Ghosh
Feb 28 at 7:26
It's not a good idea to use more then 1 DEFAULT virtual host: VirtualHost *:80
â Dexter Morganov
Feb 28 at 7:41
It's not a good idea to use more then 1 DEFAULT virtual host: VirtualHost *:80
â Dexter Morganov
Feb 28 at 7:41
 |Â
show 3 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
1 Setup correct records for domain names in /etc/hosts
.
This means that you are running apache2
on same computer that you are trying to get access to it via browser. Otherwise, set correct IP address.
127.0.0.1 example.com
127.0.0.1 example1.com
2 Adjust your apache virtualhost configuration
/etc/apache2/sites-available/example.com.conf
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@example.com
ServerName example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
<Directory /var/www/example.com/public_html/ >
Require all granted
AllowOverride All
Options Indexes
</Directory>
</VirtualHost>
/etc/apache2/sites-available/example1.com.conf
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@example1.com
ServerName example1.com
DocumentRoot /var/www/example1.com/public_html
ErrorLog /var/www/example1.com/logs/error.log
CustomLog /var/www/example1.com/logs/access.log combined
<Directory /var/www/example1.com/public_html/ >
Require all granted
AllowOverride All
Options Indexes
</Directory>
</VirtualHost>
3 Create required directories
sudo mkdir -p /var/www/example.com/public_html,logs
sudo mkdir -p /var/www/example1.com/public_html,logs
4 Enable virtualhosts
sudo a2ensite example.com
sudo a2ensite example1.com
5 Restart apache2 for apply changes
sudo service apache2 restart
or
sudo /etc/init.d/apache2 restart
6 Check that it works
Create different index files for both hosts
echo "example.com" | sudo tee /var/www/example.com/public_html/index.html
echo "example1.com" | sudo tee /var/www/example1.com/public_html/index.html
Open browser and navigate to example.com
. You should see "example.com"
Navigate to example1.com
. You should see "example1.com".
Got one Apache error" Failed to start LSB: Apache2 web server"
â Anirban Ghosh
Feb 28 at 8:41
check out your/etc/apache2/ports.conf
, it should containListen 80
orListen 127.0.0.1:80
directive. Additionally, provide last records from /var/log/apache2/error.log
â Dexter Morganov
Feb 28 at 8:44
Also, be sure that you have created all required directories. If apache can't create log file - it can't start
â Dexter Morganov
Feb 28 at 8:56
when second one works fine then first one cant access those file or folder, now example1.com works fine but example.com file/folder cant access in browser its goes to not found.
â Anirban Ghosh
Feb 28 at 9:02
oh! do you need 2 virtual hosts with 1 document root?
â Dexter Morganov
Feb 28 at 9:57
 |Â
show 2 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
1 Setup correct records for domain names in /etc/hosts
.
This means that you are running apache2
on same computer that you are trying to get access to it via browser. Otherwise, set correct IP address.
127.0.0.1 example.com
127.0.0.1 example1.com
2 Adjust your apache virtualhost configuration
/etc/apache2/sites-available/example.com.conf
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@example.com
ServerName example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
<Directory /var/www/example.com/public_html/ >
Require all granted
AllowOverride All
Options Indexes
</Directory>
</VirtualHost>
/etc/apache2/sites-available/example1.com.conf
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@example1.com
ServerName example1.com
DocumentRoot /var/www/example1.com/public_html
ErrorLog /var/www/example1.com/logs/error.log
CustomLog /var/www/example1.com/logs/access.log combined
<Directory /var/www/example1.com/public_html/ >
Require all granted
AllowOverride All
Options Indexes
</Directory>
</VirtualHost>
3 Create required directories
sudo mkdir -p /var/www/example.com/public_html,logs
sudo mkdir -p /var/www/example1.com/public_html,logs
4 Enable virtualhosts
sudo a2ensite example.com
sudo a2ensite example1.com
5 Restart apache2 for apply changes
sudo service apache2 restart
or
sudo /etc/init.d/apache2 restart
6 Check that it works
Create different index files for both hosts
echo "example.com" | sudo tee /var/www/example.com/public_html/index.html
echo "example1.com" | sudo tee /var/www/example1.com/public_html/index.html
Open browser and navigate to example.com
. You should see "example.com"
Navigate to example1.com
. You should see "example1.com".
Got one Apache error" Failed to start LSB: Apache2 web server"
â Anirban Ghosh
Feb 28 at 8:41
check out your/etc/apache2/ports.conf
, it should containListen 80
orListen 127.0.0.1:80
directive. Additionally, provide last records from /var/log/apache2/error.log
â Dexter Morganov
Feb 28 at 8:44
Also, be sure that you have created all required directories. If apache can't create log file - it can't start
â Dexter Morganov
Feb 28 at 8:56
when second one works fine then first one cant access those file or folder, now example1.com works fine but example.com file/folder cant access in browser its goes to not found.
â Anirban Ghosh
Feb 28 at 9:02
oh! do you need 2 virtual hosts with 1 document root?
â Dexter Morganov
Feb 28 at 9:57
 |Â
show 2 more comments
up vote
0
down vote
accepted
1 Setup correct records for domain names in /etc/hosts
.
This means that you are running apache2
on same computer that you are trying to get access to it via browser. Otherwise, set correct IP address.
127.0.0.1 example.com
127.0.0.1 example1.com
2 Adjust your apache virtualhost configuration
/etc/apache2/sites-available/example.com.conf
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@example.com
ServerName example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
<Directory /var/www/example.com/public_html/ >
Require all granted
AllowOverride All
Options Indexes
</Directory>
</VirtualHost>
/etc/apache2/sites-available/example1.com.conf
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@example1.com
ServerName example1.com
DocumentRoot /var/www/example1.com/public_html
ErrorLog /var/www/example1.com/logs/error.log
CustomLog /var/www/example1.com/logs/access.log combined
<Directory /var/www/example1.com/public_html/ >
Require all granted
AllowOverride All
Options Indexes
</Directory>
</VirtualHost>
3 Create required directories
sudo mkdir -p /var/www/example.com/public_html,logs
sudo mkdir -p /var/www/example1.com/public_html,logs
4 Enable virtualhosts
sudo a2ensite example.com
sudo a2ensite example1.com
5 Restart apache2 for apply changes
sudo service apache2 restart
or
sudo /etc/init.d/apache2 restart
6 Check that it works
Create different index files for both hosts
echo "example.com" | sudo tee /var/www/example.com/public_html/index.html
echo "example1.com" | sudo tee /var/www/example1.com/public_html/index.html
Open browser and navigate to example.com
. You should see "example.com"
Navigate to example1.com
. You should see "example1.com".
Got one Apache error" Failed to start LSB: Apache2 web server"
â Anirban Ghosh
Feb 28 at 8:41
check out your/etc/apache2/ports.conf
, it should containListen 80
orListen 127.0.0.1:80
directive. Additionally, provide last records from /var/log/apache2/error.log
â Dexter Morganov
Feb 28 at 8:44
Also, be sure that you have created all required directories. If apache can't create log file - it can't start
â Dexter Morganov
Feb 28 at 8:56
when second one works fine then first one cant access those file or folder, now example1.com works fine but example.com file/folder cant access in browser its goes to not found.
â Anirban Ghosh
Feb 28 at 9:02
oh! do you need 2 virtual hosts with 1 document root?
â Dexter Morganov
Feb 28 at 9:57
 |Â
show 2 more comments
up vote
0
down vote
accepted
up vote
0
down vote
accepted
1 Setup correct records for domain names in /etc/hosts
.
This means that you are running apache2
on same computer that you are trying to get access to it via browser. Otherwise, set correct IP address.
127.0.0.1 example.com
127.0.0.1 example1.com
2 Adjust your apache virtualhost configuration
/etc/apache2/sites-available/example.com.conf
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@example.com
ServerName example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
<Directory /var/www/example.com/public_html/ >
Require all granted
AllowOverride All
Options Indexes
</Directory>
</VirtualHost>
/etc/apache2/sites-available/example1.com.conf
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@example1.com
ServerName example1.com
DocumentRoot /var/www/example1.com/public_html
ErrorLog /var/www/example1.com/logs/error.log
CustomLog /var/www/example1.com/logs/access.log combined
<Directory /var/www/example1.com/public_html/ >
Require all granted
AllowOverride All
Options Indexes
</Directory>
</VirtualHost>
3 Create required directories
sudo mkdir -p /var/www/example.com/public_html,logs
sudo mkdir -p /var/www/example1.com/public_html,logs
4 Enable virtualhosts
sudo a2ensite example.com
sudo a2ensite example1.com
5 Restart apache2 for apply changes
sudo service apache2 restart
or
sudo /etc/init.d/apache2 restart
6 Check that it works
Create different index files for both hosts
echo "example.com" | sudo tee /var/www/example.com/public_html/index.html
echo "example1.com" | sudo tee /var/www/example1.com/public_html/index.html
Open browser and navigate to example.com
. You should see "example.com"
Navigate to example1.com
. You should see "example1.com".
1 Setup correct records for domain names in /etc/hosts
.
This means that you are running apache2
on same computer that you are trying to get access to it via browser. Otherwise, set correct IP address.
127.0.0.1 example.com
127.0.0.1 example1.com
2 Adjust your apache virtualhost configuration
/etc/apache2/sites-available/example.com.conf
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@example.com
ServerName example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
<Directory /var/www/example.com/public_html/ >
Require all granted
AllowOverride All
Options Indexes
</Directory>
</VirtualHost>
/etc/apache2/sites-available/example1.com.conf
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@example1.com
ServerName example1.com
DocumentRoot /var/www/example1.com/public_html
ErrorLog /var/www/example1.com/logs/error.log
CustomLog /var/www/example1.com/logs/access.log combined
<Directory /var/www/example1.com/public_html/ >
Require all granted
AllowOverride All
Options Indexes
</Directory>
</VirtualHost>
3 Create required directories
sudo mkdir -p /var/www/example.com/public_html,logs
sudo mkdir -p /var/www/example1.com/public_html,logs
4 Enable virtualhosts
sudo a2ensite example.com
sudo a2ensite example1.com
5 Restart apache2 for apply changes
sudo service apache2 restart
or
sudo /etc/init.d/apache2 restart
6 Check that it works
Create different index files for both hosts
echo "example.com" | sudo tee /var/www/example.com/public_html/index.html
echo "example1.com" | sudo tee /var/www/example1.com/public_html/index.html
Open browser and navigate to example.com
. You should see "example.com"
Navigate to example1.com
. You should see "example1.com".
edited Feb 28 at 11:04
answered Feb 28 at 7:39
![](https://i.stack.imgur.com/xmSEA.png?s=32&g=1)
![](https://i.stack.imgur.com/xmSEA.png?s=32&g=1)
Dexter Morganov
42228
42228
Got one Apache error" Failed to start LSB: Apache2 web server"
â Anirban Ghosh
Feb 28 at 8:41
check out your/etc/apache2/ports.conf
, it should containListen 80
orListen 127.0.0.1:80
directive. Additionally, provide last records from /var/log/apache2/error.log
â Dexter Morganov
Feb 28 at 8:44
Also, be sure that you have created all required directories. If apache can't create log file - it can't start
â Dexter Morganov
Feb 28 at 8:56
when second one works fine then first one cant access those file or folder, now example1.com works fine but example.com file/folder cant access in browser its goes to not found.
â Anirban Ghosh
Feb 28 at 9:02
oh! do you need 2 virtual hosts with 1 document root?
â Dexter Morganov
Feb 28 at 9:57
 |Â
show 2 more comments
Got one Apache error" Failed to start LSB: Apache2 web server"
â Anirban Ghosh
Feb 28 at 8:41
check out your/etc/apache2/ports.conf
, it should containListen 80
orListen 127.0.0.1:80
directive. Additionally, provide last records from /var/log/apache2/error.log
â Dexter Morganov
Feb 28 at 8:44
Also, be sure that you have created all required directories. If apache can't create log file - it can't start
â Dexter Morganov
Feb 28 at 8:56
when second one works fine then first one cant access those file or folder, now example1.com works fine but example.com file/folder cant access in browser its goes to not found.
â Anirban Ghosh
Feb 28 at 9:02
oh! do you need 2 virtual hosts with 1 document root?
â Dexter Morganov
Feb 28 at 9:57
Got one Apache error" Failed to start LSB: Apache2 web server"
â Anirban Ghosh
Feb 28 at 8:41
Got one Apache error" Failed to start LSB: Apache2 web server"
â Anirban Ghosh
Feb 28 at 8:41
check out your
/etc/apache2/ports.conf
, it should contain Listen 80
or Listen 127.0.0.1:80
directive. Additionally, provide last records from /var/log/apache2/error.logâ Dexter Morganov
Feb 28 at 8:44
check out your
/etc/apache2/ports.conf
, it should contain Listen 80
or Listen 127.0.0.1:80
directive. Additionally, provide last records from /var/log/apache2/error.logâ Dexter Morganov
Feb 28 at 8:44
Also, be sure that you have created all required directories. If apache can't create log file - it can't start
â Dexter Morganov
Feb 28 at 8:56
Also, be sure that you have created all required directories. If apache can't create log file - it can't start
â Dexter Morganov
Feb 28 at 8:56
when second one works fine then first one cant access those file or folder, now example1.com works fine but example.com file/folder cant access in browser its goes to not found.
â Anirban Ghosh
Feb 28 at 9:02
when second one works fine then first one cant access those file or folder, now example1.com works fine but example.com file/folder cant access in browser its goes to not found.
â Anirban Ghosh
Feb 28 at 9:02
oh! do you need 2 virtual hosts with 1 document root?
â Dexter Morganov
Feb 28 at 9:57
oh! do you need 2 virtual hosts with 1 document root?
â Dexter Morganov
Feb 28 at 9:57
 |Â
show 2 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1010531%2fhow-to-set-up-second-apache-virtual-hosts-on-ubuntu%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Please, share configuration for both virtualhosts
â Dexter Morganov
Feb 28 at 7:18
in /var/www/html/ there are two virtual host example.com and example1.com then /public_html then my folder. and in /etc/apache2/sites-available/example.com.conf
â Anirban Ghosh
Feb 28 at 7:21
and in /etc/apache2/sites-available/example.com.conf <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example.com/public_html serverAlias www.example.com Alias /phpmyadmin "/usr/share/phpmyadmin/" <Directory "/usr/share/phpmyadmin/"> Order allow,deny Allow from all Require all granted </Directory> ErrorLog $APACHE_LOG_DIR/error.log CustomLog $APACHE_LOG_DIR/access.log combined </VirtualHost>
â Anirban Ghosh
Feb 28 at 7:25
and second one /etc/apache2/sites-available/example1.com.conf <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example1.com/public_html serverAlias www.example1.com Alias /phpmyadmin "/usr/share/phpmyadmin/" <Directory "/usr/share/phpmyadmin/"> Order allow,deny Allow from all Require all granted </Directory> ErrorLog $APACHE_LOG_DIR/error.log CustomLog $APACHE_LOG_DIR/access.log combined </VirtualHost>
â Anirban Ghosh
Feb 28 at 7:26
It's not a good idea to use more then 1 DEFAULT virtual host: VirtualHost *:80
â Dexter Morganov
Feb 28 at 7:41