Forked from ankurk91/example-virtual-host.ssl.test.conf
Created
August 10, 2023 09:11
-
-
Save akhilesh-sirvi92/27ccc722aabdae9dbe14f5f6e91e623f 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