Wednesday, May 28, 2014

How To Create Web Server In Linux

7:22 PM

A Red Hat Certified System Administrator (RHCSA) is able to perform the following tasks:


  • Understand and use essential tools for handling files, directories, command-line environments, and documentation
  • Operate running systems, including booting into different run levels, identifying processes, starting and stopping virtual machines, and controlling services
  • Configure local storage using partitions and logical volumes
  • Create and configure file systems and file system attributes, such as permissions, encryption, access control lists, and network file systems
  • Deploy, configure, and maintain systems, including software installation, update, and core services
  • Manage users and groups, including use of a centralized directory for authentication
  • Manage security, including basic firewall and SELinux configuration.




Create a web server

Set document root to   /var/www/html

CMD:

root@linuxstorage:~#yum install httpd* -y

root@linuxstorage:~#vim /etc/httpd/conf/httpd.conf   (configuration path for web server)

#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

copy the last 7 line and paste in last and change all dummy host in your hostname

change document root to /var/www/html

:wq   (save file)

root@linuxstorage:~#httpd -S    (to check above configuration is correct or not)

root@linuxstorage:~#httpd -t    (to check above configuration is correct or not)

root@linuxstorage:~#cd /var/www/html     (change directory to document root )

root@linuxstorage:~#vi index.html      (add some content in index.html to check )

Restart web server service after all configuration

root@linuxstorage:~#service httpd restart

Make sure httpd service is on in chkconfig so while server restarts this service will also will start if now we should manually start the service.So please on the service in chkconfig.



root@linuxstorage:~#chkconfig httpd on 

To check the web server in command line


root@linuxstorage:~#elinks httpd://linuxstorages.com

This will display the content of index.html which means our configuration is correct.

Written by

0 comments :

Post a Comment

 

© 2014 Linux Storages | Updated . All rights resevered. Designed by Templateism