Open main menu

CDOT Wiki β

Changes

Tung httpd conf

335 bytes added, 17:42, 27 July 2011
Create a web script in user's home
===Create a web script in user's home===
#Login as a root
#Edit configuration file <b><code><font color=brown >/etc/httpd/conf/httpd.conf </font></code></b>again. Add lines#Restart the Apache server: <b><code><font color=green >service httpd restart</font></code></b>#By default, selinux doesn't allow Apache Server to read file inside user's home. Change the default setting: <b><code><font color=green > setsebool -P httpd_enable_cgi 1</font></code></b>
#Add context type to make script exexutable. To do that you need to add expressions for cgi file and public_html that more specific that the default expression.
#*For public_html: <b><code><font color=green >semanage fcontext -at httpd_sys_script_exec_t "/home/[^/]*/public_html"</font></code></b>#*For cgi files: <b><code><font color=green >semanage fcontext -at httpd_sys_script_exec_t "/home/[^/]*/public_html/.+\.cgi"</font></code></b>#*For non-cgi files: <b><code><font color=green >semanage fcontext -at httpd_user_content_t "/home/[^/]*/public_html/.+"</font></code></b>
#Apply the context: restorecon -vRF public_html
#Logout root
#Create diskfree.cgi and change its permission to executable: <b><code><font color=green >chmod 705 /home/user/public_html/*.cgi</font></code></b>
#Write lines in diskfree.cgi
#Open a browser, and enter <code>http://hostname/~your-user-id/diskfree.cgi </code> . The disk usage of your computer should be displayed.
1
edit