How to install and configure suphp easily



IF you are using CentOS follow these methods

Make sure you add these repository on CentOS 


Next import the key
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
Verify and Install the Key
rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm 
rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm
Then install suphp using yum
yum install suphp

Now edit /etc/suphp.conf


[global]
logfile=/var/log/httpd/suphp_log
loglevel=info
webserver_user=apache
docroot=/var/www:${HOME}/public_html
env_path=/bin:/usr/bin
umask=0022
min_uid=500
min_gid=48

; Security options
allow_file_group_writeable=false
allow_file_others_writeable=false
allow_directory_group_writeable=false
allow_directory_others_writeable=false

;Check wheter script is within DOCUMENT_ROOT
check_vhost_docroot=false

;Send minor error messages to browser
errors_to_browser=false

[handlers]
;Handler for php-scripts
x-httpd-php="php:/usr/bin/php-cgi"

;Handler for CGI-scripts
x-suphp-cgi="execute:!self"

Now edit  the file /etc/httpd/conf.d/suphp.conf

suPHP_Engine on
DirectoryIndex index.php index.html

Now edit the file /etc/httpd/conf/httpd.conf

Comment  line #UserDir disable
Uncomment line UserDir public_html 

Once these configurations are done restart your apache

service httpd restart

Now your apache server is configured you using suphp.

Folders works under the permission chmod 755 and files under chmod 644

Sample Folder structure 

/var/www/html/testweb/public_html/index.html

testweb    should be chmod 711

public_html should  chmod 755

Hosting files should be kept  under public_html under permission 755 for folders and 644 for files 

 http://ipaddress~username will deploy the website 

No comments:

Post a Comment