Apache Web
Server Installation and Configuration with PHP support
This guide will gudie you through a basic setup of Apache with PHP support to host user websites and virtual user sites.
(Important: Read agreement at bottom of document before continuing)
|
$ su Password: |
|
# yum groupinstall
'Web Server' |
|
# gedit
/etc/httpd/conf/httpd.conf |
|
# nano
/etc/httpd/conf/httpd.conf |
My
hostname is:
lintush.m2t.com. When done, save and
close the file.
|
line |
Replace
with |
|
ServerAdmin
root@localhost |
ServerAdmin
jesse@m2t.com |
|
#ServerName
www.example.com:80 |
ServerName
lintush.m2t.com |
|
UserDir
disable |
#UserDir
disable |
|
#UserDir
public_html |
UserDir
public_html |
|
Find
this section #<Directory /home/*/public_html> # AllowOverride FileInfo AuthConfig Limit # Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec # <Limit GET POST OPTIONS> # Order allow,deny # Allow from all # </Limit> # <LimitExcept GET POST OPTIONS> # Order deny,allow # Deny from all # </LimitExcept> #</Directory> |
|
|
Replace
with <Directory /home/*/public_html> AllowOverride FileInfo AuthConfig Limit Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory> |
|
|
Line |
|
|
Replace
with |
|
|
#NameVirtualHost
*:80 |
NameVirtualHost
*:80 |
|
# service httpd
start |

|
$ cd /var/www/html |
|
$ nano index.php |
|
<?php
echo "<H1>Welcome to Apache & PHP</H1>"; echo "<HR>"; echo "<H2>Hello, world!</H2>"; echo "<HR>"; echo "<H3>Apache and php are now working.</H3>"; php?> |

|
# adduser web # chmod 711 /home/web |
Change
password for user 'web'
to
'123456'
|
# passwd web
Changing password for user web. New UNIX password: BAD PASSWORD: it is too simplistic/systematic Retype new UNIX password: passwd:
all authentication tokens updated
successfully. |
|
# su -l web $ |
|
$ mkdir public_html $ cd public_html |
|
$ nano index.php |
|
<?php phpinfo(); php?> |
|
$ exit # |
Now
lets check if the user setup and php work. Open up firefox and try
it with user web, http://localhost/~web,
if you get the php configuration page shown below then apache is
confgured correctly to support users personal websites under the
public_html
folder and php support works. If you get access denied then the
permissions for the user home directory are most likely set to 700.
They must be set to 711.

Done!
| Message posted on Monday, December 3, 2007 at 09:35:29 pm By: Jesse | |
|---|---|
| Hello Fedora Community, Here is a small how-to on Apache. I hope it helps someone out. | |