technical skills grow

Responsive Ads Here

Sunday, July 18, 2021

APACHE VIRTUAL WEB HOSTING | REDIRECT WEBSITE | PORT BASED WEB HOSTING

 

HOW TO CONFIGURE VIRTUAL WEB HOSTING 

 [root@dev ~]# vi  /etc/httpd/conf.d/ip.conf
<VirtualHost 192.168.0.10:80>
ServerAdmin root@dev.example.com
ServerName  www1.example.com
DocumentRoot /var/www/
</virtualhost>
<Directory "/var/www/">
AllowOverride none
Require all Granted
</Directory>

[root@dev ~]# vi /var/www/index.html 

[root@dev ~]# vi /etc/hosts 

192.168.105.62 www1.example.com
192.168.105.62 www2.example.com

[root@dev ~]# firewall-cmd --permanent --add-service=http
success
[root@dev ~]# firewall-cmd --complete-reload
success

[root@dev ~]# elinks www1.example.com  

HOW TO REDIRECT WEBSITE

 [root@dev ~]# vi  /etc/httpd/conf.d/virtual.conf  

<VirtualHost *:80>
ServerAdmin root@dev.example.com
ServerName  www1.example.com
DocumentRoot /var/www/
Redirect  /  "https://www.ecollege.life"
</virtualhost>
<Directory "/var/www/">
AllowOverride none
Require all Granted
</Directory>
 

[root@dev ~]# vi /var/www/index.html

PORT BASED WEB HOSTING

 [root@dev ~]# vi  /etc/httpd/conf.d/port.conf  

<VirtualHost *:8999>
ServerAdmin root@dev.example.com
ServerName  www1.example.com
DocumentRoot /var/www/
</virtualhost>
<Directory "/var/www/">
AllowOverride none
Require all Granted
</Directory>

[root@dev ~]# vi /var/www/index.html  
[root@dev ~]# vi /etc/httpd/conf/httpd.conf  
Listen 8999
[root@dev ~]# semanage port -a -t http_port_t -p tcp 8999
[root@dev ~]# firewall-cmd --permanent --add-port=8999/tcp
success
[root@dev ~]# systemctl restart httpd
[root@dev ~]# firewall-cmd --complete-reload
[root@dev ~]# elinks www3.example.com:8999
[root@dev ~]#firewall-cmd --permanent --add-port=21/tcp 
[root@dev ~]#firewall-cmd --permanent --add-service=ftp
Restart firewall:
[root@dev ~]#firewall-cmd --reload
[root@dev ~]# netstat -tulpn | grep LISTEN

No comments:

Post a Comment

Powered by Blogger.

Labels

Contact Form

Name

Email *

Message *

Search This Blog

Blog Archive

Ad Code

Responsive Advertisement

Recent Posts