Apache: Difference between revisions
From KlavoWiki
Jump to navigationJump to search
New page: = Allowing .htaccess = To use the .htaccess files with Apache<br> '''/etc/httpd/conf/httpd.conf''' <pre> AllowOverride All </pre> = Default Load Pages = To change the global settings for A... |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= Installation = | |||
<pre> | |||
yum install httpd | |||
chkconfig httpd on | |||
service httpd start | |||
</pre> | |||
= Allowing .htaccess = | = Allowing .htaccess = | ||
To use the .htaccess files with Apache<br> | To use the .htaccess files with Apache<br> | ||
Line 9: | Line 16: | ||
'''/etc/httpd/conf/httpd.conf''' | '''/etc/httpd/conf/httpd.conf''' | ||
<pre> | <pre> | ||
DirectoryIndex index.html index.htm index.html.var | DirectoryIndex index.php index.html index.htm index.html.var | ||
</pre> | </pre> | ||
= Creating Passwords = | = Creating Passwords = | ||
To create a password to access a site/folder you need to create 2 files in the folder location of the WEB site.<br> | To create a password to access a site/folder you need to create 2 files in the folder location of the WEB site.<br> | ||
Line 24: | Line 32: | ||
</Limit> | </Limit> | ||
</pre> | </pre> | ||
=== Loading a Specific File === | |||
<pre> | |||
DirectoryIndex myfile.php | |||
</pre> | |||
== .htpasswd == | == .htpasswd == | ||
To aquire an encrypted password I have found [http://www.mv.com/webtools/htpasswd.cgi this] site to be quite good. | To aquire an encrypted password I have found [http://www.mv.com/webtools/htpasswd.cgi this] site to be quite good, or use the following command. | ||
<pre> | |||
htpasswd -nb username password | |||
</pre> | |||
<pre> | <pre> | ||
username1:entrypted-password | username1:entrypted-password | ||
username2:entrypted-password | username2:entrypted-password | ||
username3:entrypted-password | |||
. | . | ||
. | . | ||
</pre> | </pre> | ||
= Multiple WEB Sites = | |||
If you are wanting to host multiple web sites with different host headers have a look at the wiki page [[VirtualHost]] | |||
[[Category : Linux]] | [[Category : Linux]] |
Latest revision as of 08:53, 11 April 2014
Installation
yum install httpd chkconfig httpd on service httpd start
Allowing .htaccess
To use the .htaccess files with Apache
/etc/httpd/conf/httpd.conf
AllowOverride All
Default Load Pages
To change the global settings for Apache to allow for different default home pages to load edit the file
/etc/httpd/conf/httpd.conf
DirectoryIndex index.php index.html index.htm index.html.var
Creating Passwords
To create a password to access a site/folder you need to create 2 files in the folder location of the WEB site.
The first file is .htaccess and the second file is .htpasswd
.htaccess
AuthUserFile /var/www/html/.htpasswd AuthName "Title for Password Login Box" AuthType Basic <Limit GET> require valid-user </Limit>
Loading a Specific File
DirectoryIndex myfile.php
.htpasswd
To aquire an encrypted password I have found this site to be quite good, or use the following command.
htpasswd -nb username password
username1:entrypted-password username2:entrypted-password username3:entrypted-password . .
Multiple WEB Sites
If you are wanting to host multiple web sites with different host headers have a look at the wiki page VirtualHost