I want to configure Application Web server so I will choose Apache webserver for host my website.
So scenario is application is run at
Port :8081 ,8082 ,8083
Server version: Apache/2.4.6 (CentOS)
Server built: Aug 8 2019 11:41:18
#yum install httpd
#vim /etc/httpd/conf/httpd.conf
Listen 8080
Listen 8081
save and exit
Go to httpd Document :- Create two directory for keep html or php files
#cd /var/www/html
#mkdir website1
#mkdir website2
[root@mh-testdb54 html]# ls
website1 website2
#cd website1
#echo "This is website 1" > index.html
#cd website2 :
#echo "This is website 2" > index.html
[root@mh-testdb54]# vim /etc/httpd/conf.d/website1.conf
<VirtualHost *:8080>
ServerAdmin root@server9.example.com
ServerName www.website1.com
DocumentRoot /var/www/website1
</VirtualHost>
<Directory "/var/www/website1">
AllowOverride none
Require All Granted
</Directory>
(save and exit this file)
[root@mh-testdb54 ]# vim /etc/httpd/conf.d/website2.conf
<VirtualHost *:8081>
ServerAdmin root@server9.example.com
ServerName www.website2.com
DocumentRoot /var/www/website2
</VirtualHost>
<Directory "/var/www/website1">
AllowOverride none
Require All Granted
</Directory>
(save and exit this file)
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-port=8081/tcp --permanent
firewall-cmd --zone=public --add-port=8082/tcp --permanent
semanage port -a -t http_port_t -p tcp 8080
semanage port -a -t http_port_t -p tcp 8081
semanage port -a -t http_port_t -p tcp 8082
setenforce 0
systemctl restart httpd
netstat -tlpn| grep httpd
tcp6 0 0 :::8080 :::* LISTEN 11721/httpd
tcp6 0 0 :::8081 :::* LISTEN 11721/httpd
tcp6 0 0 :::8082 :::* LISTEN 11721/httpd
#curl 192.168.105.54:8080
This is webiste1
#curl 192.168.105.54:8081
This is webiste2
If you want to resolve ip to hostname so goto
#vim /etc/hosts
192.168.105.54 www.website1.com
192.168.105.54 www.website2.com
No comments:
Post a Comment