Last active
October 30, 2016 10:02
-
-
Save me-shaon/1e7f3b5d42dee7e3675f1a0ad83cc1a5 to your computer and use it in GitHub Desktop.
Create Virtual Host in Apache Server (Ubuntu)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Go to /etc/apache2/sites-available/ | |
# Create a file with the name of the virtual host consisting the '.conf' extension. Like myproject.com.conf | |
# Put the following code on that file | |
<VirtualHost *:80> | |
ServerName myproject.com | |
ServerAlias www.myproject.com | |
DocumentRoot /var/www/html/file_path_of_the_project | |
<Directory /var/www/html/file_path_of_the_project> | |
Options -Indexes +FollowSymLinks +MultiViews | |
AllowOverride All | |
Require all granted | |
</Directory> | |
ErrorLog ${APACHE_LOG_DIR}/myproject-error.log | |
# Possible values include: debug, info, notice, warn, error, crit, | |
# alert, emerg. | |
LogLevel warn | |
CustomLog ${APACHE_LOG_DIR}/myproject-access.log combined | |
</VirtualHost> | |
#Run the following command to enable the virtual host | |
sudo a2ensite myproject.com.conf | |
sudo service apache2 reload | |
# Update the /etc/hosts file with something similar to following | |
127.0.1.5 myproject.com | |
# So that the request to the myproject.com can be resolved by the host file to our own local server | |
# And that's it. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A details article about it can be found here.