Last active
March 26, 2016 22:01
-
-
Save romanitalian/fb6390550530596d7197 to your computer and use it in GitHub Desktop.
Последовательность комманд/действий для создания виртуальных хостов: example.com and test.com
This file contains hidden or 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
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