Arquivo da categoria: Apache

Apache localhost/~username/ not working

Looks like you need to uncomment the following:

#LoadModule userdir_module libexec/apache2/


#Include /private/etc/apache2/extra/httpd-userdir.conf

Then in httpd-userdir.conf you may need to uncomment:

#Include /private/etc/apache2/users/*.conf

Lastly you would need to create /private/etc/apache2/users/kevin.conf if it doesn’t exist. I think it should look something like this:

  Options Indexes MultiViews
  AllowOverride None
  Require all granted

Make sure to restart the Apache server afterwards with:

sudo apachectl restart

How To Set Up mod_rewrite for Apache on Ubuntu 14.04


In this tutorial, we will activate and learn how to manage URL rewrites using Apache2’s mod_rewritemodule. This tool allows us to rewrite URLs in a cleaner fashion, translating human-readable paths into code-friendly query strings.

This guide is split into two halves: the first sets up a sample web application and the second explains commonly-used rewrite rules.

Step 1 — Installing Apache

In this step, we will use a built-in package installer called apt-get. It simplifies management drastically and facilitates a clean installation.

First, update the system’s package index. This will ensure that old or outdated packages do not interfere with the installation.

  • sudo apt-get update

Apache2 is the aforementioned HTTP server and the world’s most commonly used. To install it, run the following:

  • sudo apt-get install apache2

For information on the differences between Nginx and Apache2, the two most popular open-source web servers, see this article.

Step 2 — Enabling mod_rewrite

Now, we need to activate mod_rewrite.

  • sudo a2enmod rewrite

This will activate the module or alert you that the module is already in effect. To put these changes into effect, restart Apache.

  • sudo service apache2 restart

Step 3 — Setting Up .htaccess

In this section, we will setup a .htaccess file for simpler rewrite rule management.

A .htaccess file allows us to modify our rewrite rules without accessing server configuration files. For this reason, .htaccess is critical to your web application’s security. The period that precedes the filename ensures that the file is hidden.

We will need to set up and secure a few more settings before we can begin.

First, allow changes in the .htaccess file. Open the default Apache configuration file using nano or your favorite text editor.

  • sudo nano /etc/apache2/sites-enabled/000-default.conf

Inside that file, you will find the <VirtualHost *:80> block on line 1. Inside of that block, add the following block:

<Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

Your file should now match the following. Make sure that all blocks are properly indented.

<VirtualHost *:80>
    <Directory /var/www/html>

        . . .


    . . .

To put these changes into effect, restart Apache.

  • sudo service apache2 restart

Now, create the .htaccess file.

  • sudo nano /var/www/html/.htaccess

Add this first line at the top of the new file to activate the RewriteEngine.

RewriteEngine on

Save and exit the file.

To ensure that other users may only read your .htaccess, run the following command to update permissions.

  • sudo chmod 644 /var/www/html/.htaccess

You now have an operational .htaccess file, to govern your web application’s routing rules.

Web Server system preference pane for Mac OS X 10.8, Mountain Lion

This can be used to start and stop the Apache Web Server on computers runing OS X 10.8, Mountain Lion. Previously, a user could start and stop Apache using the Sharing Preference Pane. But that feature was removed in OS X 10.8.

This is a partial replacement. It allows you to start and stop the computer web server. On systems previous to 10.8, you could use the built-in preference pane for the directory of web files for the current user.

Download Web Server Preference Pane


Use with versions of Mac OS X other than 10.8, Mountain Lion

This preference pane will work with earlier versions. It serves no real purpose. But if you do use it with 10.7, for example, be sure to use the Web Sharing preference pane to turn off Web Sharing first.


The download is a disk image file (.dmg). Double click to mount it. It contains the pane. Double-click the pane. It will open the System Preferences application and give you a choice of installing the pane for personal or system use. You can do either. If you install for system use, you will need to enter the password of an administrator user.


If you need to remove the pane, you find its file in the finder. Use the command in the Go menu, Go to Folder…. You will be prompted to enter the a file path.

If the pane has been installed for personal use, enter:


If it is installed for system use, enter:


This will open up the directory which contains the pane. Its name is:

Web Server.prefPane

To uninstall just drag that file into any other folder or the trash. Close and open the System Preferences application and it will be gone.

Programming: Bob Ackerman, rdacker at and Danny Swarzman, danny at stowlake dot com
Also by the Danny, Peggy, an iOS app to play peg solitaire