Last active
August 29, 2015 14:04
-
-
Save oxocode/af61fd18edadb6a72e4d to your computer and use it in GitHub Desktop.
Centos 6 vhost Setup
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
## | |
## Use after Centos 6 LAMP Setup | |
## | |
sudo mkdir -p /var/www/vhosts/DOMAIN.com/public_html | |
sudo chown -R USER:USER /var/www/vhosts/DOMAIN.com/public_html | |
sudo chmod -R 755 /var/www/vhosts/ | |
sudo vi /etc/httpd/conf/httpd.conf | |
## | |
## At the bottom of this file insert the following line: | |
## Include vhost.d/*.conf | |
## | |
sudo mkdir /etc/httpd/vhost.d/ | |
touch /etc/httpd/vhost.d/default.template | |
vi /etc/httpd/vhost.d/default.template | |
## | |
## Add the following to the file. | |
## Open and Close with the < VirtualHost > directive | |
## | |
<VirtualHost *:80> | |
ServerName DOMAIN.com | |
ServerAlias www.DOMAIN.com | |
DocumentRoot /var/www/vhosts/DOMAIN.com/public_html | |
<Directory /var/www/vhosts/DOMAIN.com/public_html> | |
Options Indexes FollowSymLinks MultiViews | |
AllowOverride All | |
</Directory> | |
CustomLog /var/log/httpd/DOMAIN.com-access.log combined | |
ErrorLog /var/log/httpd/DOMAIN.com-error.log | |
# Possible values include: debug, info, notice, warn, error, crit, | |
# alert, emerg. | |
LogLevel warn | |
</VirtualHost> | |
#<VirtualHost _default_:443> | |
# ServerName example.com | |
# DocumentRoot /var/www/vhosts/domain.com/public_html | |
# <Directory /var/www/vhosts/domain.com/public_html> | |
# Options Indexes FollowSymLinks MultiViews | |
# AllowOverride All | |
# </Directory> | |
# CustomLog /var/log/httpd/example.com-ssl-access.log combined | |
# ErrorLog /var/log/httpd/example.com-ssl-error.log | |
# Possible values include: debug, info, notice, warn, error, crit, | |
# alert, emerg. | |
# LogLevel warn | |
# SSLEngine on | |
# SSLCertificateFile /etc/ssl/certs/domain.crt | |
# SSLCertificateKeyFile /etc/ssl/certs/domain.key | |
#</VirtualHost> | |
## | |
## Save and Close it, and then use the following to copy it to a new file for each domain name. | |
## | |
sudo cp /etc/httpd/vhost.d/default.template /etc/httpd/vhost.d/DOMAIN.com.conf | |
sudo vi /etc/httpd/vhost.d/DOMAIN.com.conf | |
sudo service httpd restart | |
## | |
## Do this for every domain that you want to setup | |
## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment