Create apache virtual host in Ubuntu
Navigate to /etc/apache2/sites-available/ and create a file with your desired domain name.
nano /etc/apache2/sites-available/mydomain.com
Next, open the file with nano or any other editor and add the those lines:
<VirtualHost *:80>
ServerName mydomain.com
DocumentRoot /home/www/mydomain.com
</VirtualHost>
Save the file and exit. After creating the apache virtual host record we need to enable it with the following command:
a2ensite mydomain.com
For the last, restart apache with this command:
service apache2 restart
nano /etc/apache2/sites-available/mydomain.com
Next, open the file with nano or any other editor and add the those lines:
<VirtualHost *:80>
ServerName mydomain.com
DocumentRoot /home/www/mydomain.com
</VirtualHost>
Save the file and exit. After creating the apache virtual host record we need to enable it with the following command:
a2ensite mydomain.com
For the last, restart apache with this command:
service apache2 restart
Configure Apache2 to listen on any port
Open the ports.conf file which can be found under the following path:
nano /etc/apache2/ports.conf
Locate the Listen directive and change the number. By default, apache listen on port 80:
Listen 8080
If you are using virtual hosts you may also want to change the port for them. You can find the virtual host directive in the same file:
NameVirtualHost *:8080
For the end, restart apache.
nano /etc/apache2/ports.conf
Locate the Listen directive and change the number. By default, apache listen on port 80:
Listen 8080
If you are using virtual hosts you may also want to change the port for them. You can find the virtual host directive in the same file:
NameVirtualHost *:8080
For the end, restart apache.
Install Apache2 HTTP Server in Ubuntu
Installing Apache under Ubuntu is very easy. You can achieve this with one command:
apt-get install apache2
If you have already installed php and mysql you might want to install those packages:
apt-get install libapache2-mod-php5 libapache2-mod-auth-mysql
apt-get install apache2
If you have already installed php and mysql you might want to install those packages:
apt-get install libapache2-mod-php5 libapache2-mod-auth-mysql