Простой WEB сервер на Centos 7.
--------------------------------- настройка сети
nano /etc/sysconfig/network-scripts/ifcfg-ens192
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6ADDR=3001:2:3:1::2/64
NAME=ens192
UUID=xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
DEVICE=ens192
ONBOOT=yes
IPADDR=192.168.110.253
PREFIX=24
GATEWAY=192.168.110.1
DNS1=192.168.111.100
DOMAIN=domain.ru
DNS2=192.168.111.200
--------------------------------- выключить фаервол
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
--
sed -i -e 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
--------------------------------- настройка NGINX
yum install -y nginx
mkdir /var/www/
nano /var/www/index.html
<html>Welcome IPv4</html>
nano /var/www/ip6/index.html
<html>Welcome IPv6</html>
--
nano /etc/nginx/nginx.conf
http {
server {
listen 80;
listen [::]:80 default_server;
server_name "";
root /var/www;
return 404;
}
server {
listen [::]:80;
server_name "ipv6.Centos7";
root /var/www/ip6;
}
server {
listen 80;
server_name "ipv4.Centos7";
root /var/www;
}
--
systemctl enable nginx
service nginx restart
service nginx status
-- проверка
nano /etc/hosts
192.168.110.253 ipv4.Centos7
3001:2:3:1::2 ipv6.Centos7
--
curl http://ipv4.Centos7
curl 192.168.110.253
curl -g -6 http://ipv6.Centos7
curl -g -6 http://[3001:2:3:1::2]
---------------------------------
systemctl disable nginx
systemctl stop nginx
--------------------------------- веб-сервер APACHE
yum install -y httpd
--
nano /etc/httpd/conf/httpd.conf
Listen 192.168.110.253:80
Listen [3001:2:3:1::2]:80
<VirtualHost 192.168.110.253:80>
ServerName bad
DocumentRoot /var/www/null/
</VirtualHost>
<VirtualHost [3001:2:3:1::2]:80>
ServerName bad
DocumentRoot /var/www/null/
</VirtualHost>
<VirtualHost 192.168.110.253:80>
ServerName ipv4.Centos7
ServerAlias Centos7
DocumentRoot /var/www/
</VirtualHost>
<VirtualHost [3001:2:3:1::2]:80>
ServerName ipv6.Centos7
ServerAlias Centos7
DocumentRoot /var/www/ip6/
</VirtualHost>
--
systemctl enable httpd
systemctl restart httpd
reboot
--
curl http://ipv4.Centos7
curl http://192.168.110.253
curl -g -6 http://ipv6.Centos7
curl -g -6 http://[3001:2:3:1::2]
--------------------------------- настройка NGINX в качестве обратного прокси для APACHE
systemctl enable nginx
nano /etc/nginx/nginx.conf
http {
server {
listen 80;
listen [::]:80;
server_name "";
root /var/www;
return 404;
}
server {
listen 80;
server_name ipv4.Centos7;
location / {
proxy_pass http://192.168.110.253:8080;
}
}
server {
listen [::]:80;
server_name "ipv6.Centos7";
location / {
proxy_pass http://[3001:2:3:1::2]:8080;
}
}
--
nano /etc/httpd/conf/httpd.conf
Listen 192.168.110.253:8080
Listen [3001:2:3:1::2]:8080
<VirtualHost 192.168.110.253:8080>
ServerName ipv4.Centos7
ServerAlias Centos7
DocumentRoot /var/www/
</VirtualHost>
<VirtualHost [3001:2:3:1::2]:8080>
ServerName ipv6.Centos7
ServerAlias Centos7
DocumentRoot /var/www/ip6/
</VirtualHost>
--
systemctl restart nginx
systemctl restart httpd
--
curl http://ipv4.Centos7
curl http://192.168.110.253
curl -g -6 http://ipv6.Centos7
curl -g -6 http://[3001:2:3:1::2]
--------------------------------- настройка времени ntp
yum -y install ntp
systemctl start ntpd
systemctl enable ntpd
--
ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime
nano /etc/sysconfig/clock
ZONE="Europe/Moscow"
--
nano /etc/ntp.conf
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
server 192.168.111.100 prefer
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
---
ntpstat
---------------------------------