Apache web server rhel5/6
APACHE (Introduction):
Apache is the world's most popular Web server (HTTP server). The original version of Apache was written for UNIX, but there are now versions that run under OS/2, Windows and other platforms.
The Apache Web server provides a full range of Web server features, including CGI, SSL, and virtual domains. Apache also supports plug-in modules for extensibility. Apache is reliable, free, and relatively easy to configure.
The Apache Web server provides a full range of Web server features, including CGI, SSL, and virtual domains. Apache also supports plug-in modules for extensibility. Apache is reliable, free, and relatively easy to configure.
Configuring Apache Web Server (RedHat/CentOS)
# yum install *httpd*(Install the package)
# cd /var/www/html
(go the html folder)
# vim index.html(create an html page, name must be index.html)
# vim /etc/httpd/conf/httpd.conf(now go to bottom of the document and type following)
ServerAdmin root@domain.com
DocumentRoot /var/www/html
ServerName srv1.domain.com
ErrorLog logs/srvb1.domain.com-error_log
CustomLog logs/srv1.domain.com-access_log common
(now go to 99% #NameVirtualHost *:80 and type following)
NameVirtualHost 192.168.1.11:80
ServerAdmin root@domain.com
DocumentRoot /var/www/html
ServerName srv1.domain.com
ErrorLog logs/srvb1.domain.com-error_log
CustomLog logs/srv1.domain.com-access_log common
(now go to 99% #NameVirtualHost *:80 and type following)
NameVirtualHost 192.168.1.11:80
# service httpd start
How to set password in apache web server. User require while opening the web site.
# cd /var/www/html
# touch .htaccess
# vim /var/www/html/.htaccess(Type the following)AuthName “restricted stuff”
AuthType Basic
AuthUserFile /etc/httpd/conf/.htpasswd-file
Require valid-user
AuthType Basic
AuthUserFile /etc/httpd/conf/.htpasswd-file
Require valid-user
# vim /etc/httpd/conf/httpd.conf(go to 31% and type the following)DocumentRoot “/var/www/html”
AllowOverride AuthConfig
AllowOverride AuthConfig
# cd /etc/httpd/conf
# htpasswd -mc .htpasswd-file user1New Password:
Retype new password:
Retype new password:
# service httpd start
Now open web browser and open website, it will require username and password. Give username user1 and its password.
No comments:
Post a Comment