Showing posts with label seb server configure in linux. Show all posts
Showing posts with label seb server configure in linux. Show all posts

Monday 14 March 2016

Step by step to configure a web server in RHEL7

Install http package [I], start [S] package service, enable [E] service and test [T] service

[root@12c-rac-node2 ~]# yum install http -y
[root@12c-rac-node2 ~]# systemctl enable httpd
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
[root@12c-rac-node2 ~]# systemctl start httpd.service
[root@12c-rac-node2 ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
   Active: active (running) since Mon 2016-03-14 13:09:07 BDT; 6s ago
 Main PID: 3054 (httpd)
   Status: "Processing requests..."
   CGroup: /system.slice/httpd.service
           ├─3054 /usr/sbin/httpd -DFOREGROUND
           ├─3055 /usr/sbin/httpd -DFOREGROUND
           ├─3056 /usr/sbin/httpd -DFOREGROUND
           ├─3057 /usr/sbin/httpd -DFOREGROUND
           ├─3058 /usr/sbin/httpd -DFOREGROUND
           └─3059 /usr/sbin/httpd -DFOREGROUND

Mar 14 13:09:07 12c-rac-node2 systemd[1]: Started The Apache HTTP Server.

[root@12c-rac-node2 ~]# firewall-cmd --add-port=80/tcp --permanent [---add port 80 to firewall to access from outside]
success
[root@12c-rac-node2 ~]# firewall-cmd --add-service=http --permanent [---add http service to firewall]
success
[root@12c-rac-node2 ~]# firewall-cmd --reload [---reload firewall service]
success
[root@12c-rac-node2 ~]#

Now create a index file in  /var/www/html location to test the web server

[root@12c-rac-node2 html]# vim index.html
[root@12c-rac-node2 html]# cat index.html
-----------This is a testing Website ----------------
[root@12c-rac-node2 html]#
[root@12c-rac-node2 html]# cat index.html
-----------This is a testing Website ----------------

Now testing the web server through command line url

[root@12c-rac-node2 html]# curl http://192.165.21.230
-----------This is a testing Website ----------------
[root@12c-rac-node2 html]#
[root@12c-rac-node2 html]# curl http://192.165.21.230:80   [---with specific port 80]
-----------This is a testing Website ----------------
[root@12c-rac-node2 html]#

######Configure web server with specific port#######

Here we will configure web server in 8008 port

[root@12c-rac-node2 html]# semanage port -l | grep http      [---check available port attached with http]
http_cache_port_t              tcp      8080, 8118, 8123, 10001-10010
http_cache_port_t              udp      3130
http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t            tcp      5988
pegasus_https_port_t           tcp      5989
[root@12c-rac-node2 html]# firewall-cmd --permanent --add-port=8008/tcp   [add 8008 port with http]
success
[root@12c-rac-node2 html]# firewall-cmd --reload [---reload firewall service]  
success
[root@12c-rac-node2 html]# vim /etc/httpd/conf/httpd.conf       [---add listen port 8008]
[root@12c-rac-node2 html]# systemctl restart httpd.service [---restart http service]

[root@12c-rac-node2 html]# curl http://192.165.21.230:8008 [---check the web server through command line browser]
-----------This is a testing Website ----------------
[root@12c-rac-node2 html]#