Skip to content

Instantly share code, notes, and snippets.

@marcialsoto
Created August 24, 2019 21:33
Show Gist options
  • Select an option

  • Save marcialsoto/88d70889f0c84848f3f3aa0a2d0dd2e6 to your computer and use it in GitHub Desktop.

Select an option

Save marcialsoto/88d70889f0c84848f3f3aa0a2d0dd2e6 to your computer and use it in GitHub Desktop.
Centos 7 VirtualHost
# Crea directorio html
sudo mkdir -p /var/www/intranet.osinfor.gob.pe/html
# Crea logs dir
sudo mkdir -p /var/www/intranet.osinfor.gob.pe/log
# Next, assign ownership of the html directory with the $USER environmental variable:
sudo chown -R $USER:$USER /var/www/intranet.osinfor.gob.pe/html
# Make sure that your web root has the default permissions set:
sudo chmod -R 755 /var/www
sudo mkdir /etc/httpd/sites-available /etc/httpd/sites-enabled
sudo vi /etc/httpd/conf/httpd.conf
#Add this line to the end of the file:
IncludeOptional sites-enabled/*.conf
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
DocumentRoot /var/www/example.com/html
ErrorLog /var/www/example.com/log/error.log
CustomLog /var/www/example.com/log/requests.log combined
</VirtualHost>
sudo ln -s /etc/httpd/sites-available/intranet.osinfor.gob.pe.conf /etc/httpd/sites-enabled/intranet.osinfor.gob.pe.conf
# Adjusting SELinux Permissions for Virtual Hosts (Recommended)
sudo setsebool -P httpd_unified 1
sudo systemctl restart httpd
ls -lZ /var/www/intranet.osinfor.gob.pe/log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment