Posts Tagged ‘apache’
After I updated my machine to Mavericks, I remembered that every OS X update kills your custom Apache settings. Here’s the minimum changes you need to get Python working again.
- Edit the Apache config file as root
sudo pico /etc/apache2/httpd.conf
- Enter your password if prompted
- Find “<Directory “/Library/WebServer/Documents”>”, then find the line the starts with “Options” and add “ExecCGI” to it. Example:
-
<Directory "/Library/WebServer/Documents">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks MultiViews ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
-
- If you have an index file with a python extension, add “index.py” to the “DirectoryIndex” module. Example:
-
<IfModule dir_module>
DirectoryIndex index.html index.py
</IfModule>
-
- Tell Apache to process “.py” files as CGI. Find “AddHandler” and add the following line:
AddHandler cgi-script .py
- Restart Apache.
sudo apachectl graceful
Done!