Skip to content

Instantly share code, notes, and snippets.

@yaleksandr89
Created June 30, 2019 14:56
Show Gist options
  • Save yaleksandr89/0f3c46697d0fc098290367e61bd8910a to your computer and use it in GitHub Desktop.
Save yaleksandr89/0f3c46697d0fc098290367e61bd8910a to your computer and use it in GitHub Desktop.
# Setup
/etc/apache2/sites-available - before creat file conf site.
/etc/apache2/sites-enabled - become сopy created file here (exists special command `sudo a2ensite {NAME_CONFIG_FILE}`).
## First
```
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/{NAME_SITE}.conf
example:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/site1.local.conf
```
the approximate contents of the file:
```
<VirtualHost *:80>
ServerName site1.local !{NAME_SITE, at creation DEL}
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/site1.local/ !{PATH_SITE_FOLDER, at creation DEL}
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
```
## Second
```
sudo a2ensite site1.local
```
This command move created file in folder /etc/apache2/sites-enabled. The file name is written without '.conf'
## Last
Reload apach
```
sudo systemctr restart apache2
```
Check in browers. Written site1.local/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment