Change localhost directory for Yosemite Apache 2.4

I’ve just installed Yosemite and I managed to change the DocumentRoot without any problems. First I modified the following lines in /private/etc/apache2/httpd.conf: DocumentRoot “/Library/WebServer/Documents” <Directory “/Library/WebServer/Documents”> Options FollowSymLinks Multiviews AllowOverride None </Directory> to: DocumentRoot “<CUSTOM_PATH>” <Directory “<CUSTOM_PATH>”> Options Indexes FollowSymLinks Multiviews AllowOverride All </Directory> The above will set a custom DocumentRoot, enable directory listing and … Read more

Standard 401 response when using HTTP auth in flask

Custom error responses are really quite easy in Flask. Create a function whose only argument is the HTTP error status code, make it return a flask.Response instance, and decorate it with @app.errorhandler. @app.errorhandler(401) def custom_401(error): return Response(‘<Why access is denied string goes here…>’, 401, {‘WWW-Authenticate’:’Basic realm=”Login Required”‘}) You can then use abort(401) to your heart’s … Read more

.htaccess File Options -Indexes on Subdirectories

The correct answer is Options -Indexes You must have been thinking of AllowOverride All https://httpd.apache.org/docs/2.2/howto/htaccess.html .htaccess files (or “distributed configuration files”) provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and … Read more

Where can I find good reference/tutorial on writing Apache modules (in C)? [closed]

Here is the list of links about apache module development that I found useful: Apache Tutor Apache Modules Development and Debugging libapr(apache portable runtime) programming tutorial The Apache Modules Book: Application Development with Apache Mailing list archives Apache at WebÞing Writing portable C code with APR Apache Modeling Project You can also download the apache … Read more

How to send compressed (deflated) SVG via Apache2?

If Apache doesn’t know the mime type of the file (here image/svg+xml), you need to tell it specifically (not needed in most Apaches): AddType image/svg+xml svg svgz Now when Apache knows about the filetype, just add this to deflate it: AddOutputFilterByType DEFLATE image/svg+xml For more information see https://httpd.apache.org/docs/2.4/mod/mod_deflate.html