Você está na página 1de 2

Apache Server

RH253

Unit 6

[root@home ~]# rpm -qa | grep httpd system-config-httpd-1.3.3.1-1.el5 httpd-2.2.3-11.el5 httpd-manual-2.2.3-11.el5 [root@home ~]# chkconfig --list | grep httpd httpd 0:off 1:off 2:off [root@home ~]# chkconfig --level 345 httpd on [root@home ~]# chkconfig --list | grep httpd httpd 0:off 1:off 2:off [root@home ~]# cd /var/www/html/ [root@home html]# cat file.html <html> <head> <title> My web Page </title> </head> <body bgcolor=gray> <h1> This is an sample page created in httpd web page </body> </html> [root@home ~]# vi /etc/httpd/conf/httpd.conf NameVirtualHost 192.168.0.1:80 <VirtualHost 192.168.0.1:80> ServerName linux.com ServerAdmin root@home.linux.com DocumentRoot /var/www/html DirectoryIndex file.html ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </VirtualHost> [root@home ~]# httpd -t Syntax OK [root@home ~]# service httpd restart Stopping httpd: Starting httpd: [FAILED] [ OK ] 3:on 4:on 5:on 6:off 3:off 4:off 5:off 6:off

To Make Security
[root@home ~]# vi /etc/httpd/conf/httpd.conf NameVirtualHost 192.168.0.1:80 <VirtualHost 192.168.0.1:80> ServerName linux.com ServerAdmin root@home.linux.com DocumentRoot /var/www/html/virtual DirectoryIndex file.html <Directory /var/www/html/virtual> Order deny,allow Allow from all AllowOverride AuthConfig </Directory> </VirtualHost> [root@home virtual]# httpd -t

Apache Server
Syntax OK [root@home ~]# cd /var/www/html/ [root@home html]# mkdir virtual [root@home html]# cd virtual

RH253

Unit 6

[root@home virtual]# cat file.html <html> <head> <title> My web Page </title> </head> <body bgcolor=gray> <h1> This is an sample page created in httpd web page </body> </html> [root@home virtual]# vi .htaccess AuthName "Home Sweet Home" AuthType Basic AuthUserFile /etc/httpd/conf/htpass require valid-user [root@home virtual]# htpasswd -cm /etc/httpd/conf/htpass sunny New password: Re-type new password: Adding password for user sunny [root@home virtual]# service httpd restart Stopping httpd: Starting httpd: in client click on Application-> Internet-> Firefox Web Browser in address bar type http://192.168.0.1 or linux.com Enter user name & password To open the page [ [ OK OK ] ]

Você também pode gostar