Skip to content

Instantly share code, notes, and snippets.

@romanitalian
Last active March 26, 2016 22:01
Show Gist options
  • Save romanitalian/fb6390550530596d7197 to your computer and use it in GitHub Desktop.
Save romanitalian/fb6390550530596d7197 to your computer and use it in GitHub Desktop.
Последовательность комманд/действий для создания виртуальных хостов: example.com and test.com
sudo rm -rf /var/www/example.com/public_html
sudo rm -rf /var/www/test.com/public_html
sudo mkdir -p /var/www/example.com/public_html
sudo mkdir -p /var/www/test.com/public_html
sudo chown -R ubuntu:ubuntu /var/www/example.com/public_html
sudo chown -R ubuntu:ubuntu /var/www/test.com/public_html
sudo chmod -R 755 /var/www
nano /var/www/example.com/public_html/index.html
Hello from example.com
cp /var/www/example.com/public_html/index.html /var/www/test.com/public_html/index.html
nano /var/www/test.com/public_html/index.html
Hello from test.com
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf
sudo nano /etc/apache2/sites-available/example.com.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo cp /etc/apache2/sites-available/example.com.conf /etc/apache2/sites-available/test.com.conf
sudo nano /etc/apache2/sites-available/test.com.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName test.com
ServerAlias www.test.com
DocumentRoot /var/www/test.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo a2ensite example.com.conf
sudo a2ensite test.com.conf
sudo service apache2 restart
sudo nano /etc/hosts
C:\Windows\System32\drivers\etc
54.191.225.64 example.com
54.191.225.64 test.com
http://example.com
http://test.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment