Last active
March 13, 2024 03:53
-
-
Save ankurk91/afee4bcd575261c5c549 to your computer and use it in GitHub Desktop.
Sample virtual host .conf file for Apache2 on 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
# This to be used when you need to implement SSL | |
# Make sure that apache mod_ssl is on | |
# You can generate self signed certificates for development | |
# http://www.selfsignedcertificate.com/ | |
<VirtualHost *:443> | |
ServerName yourapp.test | |
#ServerAlias www.yourapp.test | |
ServerAdmin webmaster@localhost | |
DocumentRoot /home/user_name/projects/project-folder | |
<Directory "/home/user_name/projects/project-folder"> | |
Order allow,deny | |
AllowOverride All | |
Allow from all | |
Require all granted | |
</Directory> | |
#ErrorLog ${APACHE_LOG_DIR}/error.log | |
#CustomLog ${APACHE_LOG_DIR}/access.log combined | |
# Enable SSL | |
SSLEngine on | |
SSLCertificateFile /path/to/www_yoursite_com.crt | |
SSLCertificateKeyFile /path/to/www_yoursite_com.key | |
</VirtualHost> |
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
# This is the minimal configuration file to create a virtual host at path | |
# /etc/apache2/sites-available/ | |
# Commands to remember- | |
# sudo a2ensite example-virtual-host.test.conf | |
# sudo service apache2 restart | |
<VirtualHost *:80> | |
ServerName yourapp.test | |
#ServerAlias www.yourapp.test | |
ServerAdmin webmaster@localhost | |
DocumentRoot /home/user_name/projects/project-folder | |
<Directory "/home/user_name/projects/project-folder"> | |
Order allow,deny | |
AllowOverride All | |
Allow from all | |
Require all granted | |
</Directory> | |
#ErrorLog ${APACHE_LOG_DIR}/error.log | |
#CustomLog ${APACHE_LOG_DIR}/access.log combined | |
</VirtualHost> | |
# Dont forget to make an entry in /etc/hosts | |
# 127.0.0.1 yourapp.test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment