FAQ   •  Поиск
Вход  •  Регистрация
 
LAMP

 
Начать новую тему   Ответить на тему    Список форумов newssoft.ru -> ????????? ???????
Предыдущая тема :: Следующая тема  
Автор Сообщение
admin
Site Admin


Зарегистрирован: 11.09.2008
Сообщения: 505

СообщениеДобавлено: Ср Окт 12, 2016 7:27 pm    Заголовок сообщения: LAMP Ответить с цитатой

UBUNTU
???????? virtualhost apache2
https://www.digitalocean.com/community/tutorials/apache-ubuntu-14-04-lts-ru
??? ????????? ??????????? ????? ? Apache ?? Ubuntu 14.04 LTS
Posted Nov 24, 2014 185.9k views Apache Getting Started Linux Basics Ubuntu
????????

???-?????? Apache ???????? ????? ?????????? ????????? ?????????? ???-???????? ? ?????????. ?? ??? ????? ????? ???????? ???? ??????????? ???-??????. ??? ????? ?????? ? ?????? ??????????.

Apache ????????? ???? ?????????????? ??????????? ? ?????????? ?? ????????? ?????, ??????? ????? ???? ????????? ? ???????????????? ?????????? ???? ?? ?????. ??????? ?????, ??????? ???????? ?? ????????? ???? ??? ????? ?????????? ??????????? ?????? (virtual host).

??? ??????? ????????? ?????????????? ???????????? ???? ??????, ????? ????????? ????????? ?????? ????????? ???? ????????? ??? IP. ??? ?????? ??? ???, ??? ????? ???????????? ???? VPS ??? ???????? ?????????? ??????.

?????? ??????????? ??????????????? ??????? ????? ????? ?????????? ???????????? ? ???????????? ?????????? ???????, ?????????? ?????????? ????? ?????, ???????????????? ??????. ??? ???? ?????????? ????? ?? ??????, ??? ?????? ?????? ?????? ? ?????? ?????. ??? ????? ????? ?????????? ??? ?????-???? ??????????? ?? ??????? ???????????? ??????????? ?? ??? ???, ???? ?????? ????? ??????????? ? ?????????.

? ???? ??????????? ?? ?????????, ??? ????????? ??????????? ????? ? Apache ?? VPS ? Ubuntu 14.04. ? ???????? ?? ???????, ??? ?????????? ?????? ??????? ??? ?????? ????????????? ? ??????????? ?? ????, ????? ????? ??? ???????????.
??????????? ???????

????? ???, ??? ??????????, ??? ?????????? ??????? ??-???????? ????????????, ??? ??????? ? ????? 1-4.

????? ? ??? ?????? ???? ?????????? Apache, ????? ????????? ??????????? ???? ????. ???? ?? ??? ?? ??????????, ?? ?????? ??????? ??? ??? ?????? ??????? apt-get:

sudo apt-get update
sudo apt-get install apache2

????? ?????????? ???? ?????, ?? ????? ?????? ????????? ??????????? ??????.

? ???? ??????????? ?? ???????? ??????????? ???? ??? ??????? example.com ? test.com. ?? ????? ????????? ?? ??? ? ???????????, ?????? ??? ??????? ???????? ?? ?? ???? ?????? ??? ????????? ????? ??????????? ??????.

??? ????????? ???????? ???? ? DigitalOcean ????????? ?? ???? ??????.

???? ? ??? ??? ????????? ???????, ?? ??????? ????? ???????????????, ?? ?????? ???????????? ????????? ???????? ?????.

???? ????? ?? ???????, ??? ??????????????? ???? ? ?????????? ??????? ??? ???????? ???????????? ? ??????, ???? ?? ??????????? ????????? ???????? ?????. ??? ???????? ?????????????? ???????????? ? ?????? ????????? ??????????, ???? ???????? ?? ??, ??? ??????? ????? ?? ????? ???????? ?? ????? ????????? ????? ?????? ?????????????.
??? 1 - ???????? ????????? ??????????

?????? ???, ??????? ?? ?????????? ???????????, ??? ??????? ????????? ??????????, ?????????? ?????? ?????, ??????? ????? ???????????? ???????????.

??? document root (???????? ??????? - ?????????? ???????? ??????, ??????? ????????????? Apache ? ??????? ???????? ??? ???????????) ????? ???????? ?? ????????????? ?????????? ?????? ?????????? /var/www. ????? ?? ???????? ?????????? ??? ????? ??????????? ??????, ??????? ?? ????????? ??????? ? ???? ???????????.

? ?????? ?? ???? ?????????? ?? ???????? ????????? ?????????? public_html, ??????? ????? ????????? ???????? ?????. ??? ???? ??? ????????? ???????? ? ????? ???????? ????????.

????????, ??? ????? ?????? ?? ???????? ?????????? ????????? ???????:

sudo mkdir -p /var/www/example.com/public_html
sudo mkdir -p /var/www/test.com/public_html

?????, ?????????? ???????, ???????????? ????? ???????? ????? ??????, ??????? ?? ????? ?????????? ? ??????? ?????? VPS.
??? 2 - ?????????? ????

?????? ? ??? ???? ????????? ?????????? ??? ????? ??????, ?? ???????? ???? ?????????? - root-????????????. ???? ?? ?????, ????? ???? ??????? ???????????? ????? ???????? ????? ? ????? ???-???????????, ?? ????? ???????? ?? ????????? ????????? ???????:

sudo chown -R $USER:$USER /var/www/example.com/public_html
sudo chown -R $USER:$USER /var/www/test.com/public_html

?????????? $USER ???????? ??? ????????????, ??? ??????? ?? ?????????? ? ??????? ??????. ?????? ??????? ???????????? ??????? ???????????? public_html, ? ??????? ?? ????? ??????? ???????.

??? ??? ?? ?????????? ??????? ??????????????? ????? ???????, ????? ?????????, ??? ?????? ?? ?????? ???????? ? ????? ???-?????????? ? ???? ?????? ? ??????, ???????????? ? ???. ??? ?????????? ??? ????, ????? ???????? ????? ???????????? ?????????:

sudo chmod -R 755 /var/www

?????? ??? ???-?????? ?????? ????? ??????????, ??????????? ??? ??????????? ????????. ????? ????, ?????? ??? ???????????? ????? ??????????? ????????? ??????? ? ??????????? ??????????.
??? 3 - ???????? ????-??????? ??? ??????? ???????????? ?????

???? ????????? ?????????? ??????. ??????? ???????? ?????-?????? ??????? ??? ??????????? ??????????? ????? ??????.

?? ?????? ??? ?????? ??? ????????????, ?????? ???????? ????? ????? ????????. ?? ?????????? ??????? ?? ???????? index.html ??? ??????? ?????.

??????? ?????? ? example.com. ?? ????? ??????? ? ??????? ???? index.html ? ?????????, ????? ???????:

nano /var/www/example.com/public_html/index.html

? ???? ????? ???????? ??????? HTML-????????, ??????? ??????????, ? ?????? ????? ?? ?????????. ??? ???? ???????? ????????? ???????:

<html>
<head>
<title>Welcome to Example.com!</title>
</head>
<body>
<h1>Success! The example.com virtual host is working!</h1>
</body>
</html>

????? ?????????, ????????? ? ???????? ????.

?? ????? ??????????? ????, ????? ???????????? ??? ??? ?????? ??? ??????? ?????:

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

<html>
<head>
<title>Welcome to Test.com!</title>
</head>
<body>
<h1>Success! The test.com virtual host is working!</h1>
</body>
</html>

????????? ? ???????? ???? ????. ?????? ? ??? ???? ????????, ??????????? ??? ???????? ???????????? ??????????? ??????.
??? 4 - ???????? ?????? ?????? ???????????? ?????

????? ??????????? ?????? ?????? ?? ????????????, ? ??????????, ??? ?????? ???-?????? Apache ????? ???????? ?? ??????? ? ?????? ???????.

?? ?????????, Apache ????? ???? ???????????? ????? 000-default.conf, ??????? ?? ????? ???????????? ? ???????? ????????? ?????. ?? ?????????? ??????????? ???, ????? ??????? ????? ???????????? ????? ??? ??????? ?? ????? ???????.

?? ?????? ? ?????? ??????, ?????????????? ???, ????????? ??? ??????? ??????, ? ????? ????? ??????? ??????????? ??????. ???????????? Ubuntu ??-????????? ???????, ????? ?????? ???? ???????????? ????? ???????????? ??????????? .conf.
???????? ????? ??????? ???????????? ?????

?????? ? ??????????? ????? ??? ??????? ??????:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf

???????? ????? ???? ? ????????? ? root-???????:

sudo nano /etc/apache2/sites-available/example.com.conf

???? ????? ????? ?? ???? (?? ??????? ???????????, ????? ??????? ??? ????? ???????????):

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

??? ??????, ???? ?????? ?????????. ?? ???????? ??? ??? ?????? ??????? ?????? ? ??????? ????????? ????? ?????????. ??? ?????? ???????????? ???????????? ????? ????????? ? ????? ????????, ??????? ??????? ?? 80 ????? (???? ??-????????? ??? HTTP).

?????? ?????, ?? ?????? ???????? ????????? ServerAdmin ?? ????? ??????????? ?????, ?? ??????? ????????????? ????? ????? ???????? ??????????? ??????.

ServerAdmin admin@example.com

????? ?? ?????? ???????? ??? ????? ?????????. ??????, ServerName, ????????????? ???????? ?????, ??????? ?????? ??????????????? ???????? ???????????? ?????. ??? ?????? ???? ???? ???????? ???. ??????, ServerAlias, ?????????? ?????? ?????, ??????? ?????? ?????????????????? ???, ??? ????? ??? ???????? ?????. ??? ?????? ??? ????????????? ?????????????? ???????? ????, ????????, ? ?????????????? www:

ServerName example.com
ServerAlias www.example.com

???????????? ????, ??????? ??? ???????? ???????? ? ??????? ????? ???????????? ?????, ??? ???????????? ????????? ???????? ????? ??????. ?? ??? ??????? ?????? ??????????, ??? ??? ??? ???????? ???????? ????????? DocumentRoot ???, ????? ??? ????????? ?? ????????? ???? ??????????:

DocumentRoot /var/www/example.com/public_html

?????? ??? ???? ???????????? ????? ?????? ????????? ????????? ???????:

<VirtualHost *:80>
ServerAdmin admin@example.com
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

???????? ????? ???? ? ????????? ? ??????? root-????????????:

sudo nano /etc/apache2/sites-available/test.com.conf

?????? ??? ????? ????????? ??? ??????????? ?????????? ??? ??????? ??????. ????? ?? ?????????, ???? ?????? ????????? ??????? ???????:

<VirtualHost *:80>
ServerAdmin admin@test.com
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>

????????? ? ???????? ???? ????? ???????? ??????.
??? 5 - ????????? ????? ??????????? ??????

??????, ????? ?? ??????? ????? ????? ??????????? ??????, ?? ?????? ?? ????????. Apache ???????? ???????????, ??????????? ??? ??? ???????.

?? ????? ???????????? ??????? a2ensite ??? ????????? ??????? ?? ????? ?????? ????????? ???????:

sudo a2ensite example.com.conf
sudo a2ensite test.com.conf

????? ?????????? ?????????? ????????????? Apache, ????? ????????? ???????? ? ????:

sudo service apache2 restart

?????? ?????, ?? ???????? ?????????, ??????? ?? ???:

* Restarting web server apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

??? ????????? ????????? ? ?? ?????? ?? ??? ????.
??? 6 - ????????? ????? ????????? ?????? (???????????)

???? ?? ????? ?? ???????????? ?? ???????? ???????? ?????, ???????? ?? ????????, ? ????????, ?? ?????? ?????????????? ????????????????? ??????????? ??????, ???????? ??????? ???? hosts ?? ????? ????????? ??????????.

??? ???????? ????????????? ????? ?????? ? ???????, ??????? ?? ????????? ? ?????????????? ??? ?? ??? VPS ?????? ???, ??? ??? ??????? ?? ??????? DNS ? ?????? ????????????? ??????? ?????????????????? ???????. ??? ????? ???????? ?????? ? ?????? ?????????? ?????????? ? ???????????? ?????? ??? ????????????.

?????????, ??? ?????????? ???? ?? ?????? ??????????? ?? ????? ????????? ??????????, ? ?? ?? VPS ???????. ??? ?????????? ????? ?????? ?????????????? ??? ???? ?????? ?????? ???????????????.

???? ?? ??????????? ????????? ? Mac ??? Linux, ?? ?????? ????????????? ????????? ???? ? ??????? ??????????????, ????? ???????:

sudo nano /etc/hosts

???? ? ??? ????????? ? Windows, ?? ?????? ????? ?????????? ?? ?????????????? ????? ?????? ?????.

??? ?????????? ???????? ? ???? ????????? IP-????? ?????? VPS ??????? ?, ??????, ???????? ???, ?? ???????? ?? ?????? ?????????? ? ????? VPS.

??? ???????, ???????????? ? ???? ???????????, ???????????, ??? IP-????? ?????? VPS 111.111.111.111. ? ???? ?????? ?? ????? ???????? ????????? ?????? ? ????? ????? hosts:

127.0.0.1 localhost
127.0.1.1 guest-desktop
111.111.111.111 example.com
111.111.111.111 test.com

? ?????????? ????? ????? ??????? ? example.com ? test.com ? ?????? ?????????? ????? ???????????????? ?? ??? ?????? ?? ?????? 111.111.111.111. ??? ?????? ??? ???????? ???????????? ????????? ????? ??????????? ?????? ??? ??????, ????? ?? ?? ???????? ????????? ??????????? ???? ???????? ????.

????????? ? ???????? ????.
??? 7 - ???????????? ???????????

??????, ????? ???? ??????????? ????? ????????????????, ?? ?????? ????? ?????????????? ?????????????????, ??????? ? ???????? ?? ????? ??????????? ???????:

http://example.com

?? ?????? ??????? ??????? ????????:

<img src="https://assets.digitalocean.com/articles/apache_virt_hosts_1404/example.png">

??????????, ?? ?????? ????? ?? ?????? ????????:

http://test.com

?? ??????? ????, ????????? ??? ??????? ?????:

<img src="https://assets.digitalocean.com/articles/apache_virt_hosts_1404/test.png">

???? ??? ????? ????????, ?????? ?? ??????? ???????????????? ??? ??????????? ????? ?? ????? ? ??? ?? ???????.

??? ?? ??????? ????????? ? ???? hosts ?? ????? ????????? ??????????, ?????? ?????? ??????? ??????????? ??????, ?.?. ??? ????????? ? ????????????????? ????????????. ????? ??????? ?? ?? ????? ??????? ? ????? "hosts" ???????? ??????.

???? ?? ??????, ????? ???????????? ????? ??????????? ? ????? ?????? ?? ?????????? ??????, ??????????? ??????????? ???????????? ???????? ???? ??? ????? ?????? ? ?? ????????? ??? ?????? ? ????? VPS ????????.
??????????

???? ?? ????????? ????? ???????????, ?????? ? ??? ?????? ???? ???? ??????, ?????????? ? ????? ??????? ????????? ???????. ??? ?????????? ?????? ??????????? ?????? ???????? ??????????? ? ???? ???????????.

Apache ????? ???????? ? ????? ??????????? ???????? ????, ??? ??? ?????? ????????? ????? ????? ?? ??? ???, ???? ??? ?????? ??????????? ? ?????????.
Вернуться к началу
Посмотреть профиль Отправить личное сообщение Отправить e-mail
Показать сообщения:   
Начать новую тему   Ответить на тему    Список форумов newssoft.ru -> ????????? ??????? Часовой пояс: GMT + 3
Страница 1 из 1

 
Перейти:  
Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете голосовать в опросах


Powered by phpBB © 2001, 2005 phpBB Group
AllSat 22  - photographe de mariage - 2006