Saturday, November 10, 2012

Permissions

You cannot access your Sencha Touch URL due to the "403 Forbidden" screen of death. 



Let me help you.


1. Access the Terminal

You can locate the Terminal in your Applications --> Utilities directory. 



I highly suggest that you keep this application in your dock since you will soon be best friends with this application.




2. Create Alias and Configure Permissions

First of all, doesn't the URL below look a lot nicer? It is shorter and a lot easier to remember. "st2" replaces "/<username>/Projects/SenchaTouch2/" in our directory structure. This is called the alias.


This has nothing to do with permissions, but I thought it would be nice to just include it here.

a. Access the httpd.conf file.

Using the terminal, type the following command:
sudo pico /etc/apache2/httpd.conf
It will require the password of your MAC's admin account. 



b. Change the httpd.conf file.

Put this code right before the line that I highlighted in red. Don't forget to replace all occurrences of "<username>" with the user account name:
Alias /st2 /Users/<username>/Sites/Projects/SenchaTouch2
<Directory "/Users/<username>/Sites/Projects/SenchaTouch2">
    Options +Indexes FollowSymLinks +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
# User home directories
Include /private/etc/apache2/extra/httpd-userdir.conf



Press Control-X, letter 'Y' for yes and press ENTER when you are finish.

3. Change your user's configuration file.

Using the terminal, type the following command:
/etc/apache2/users/`whoami`.conf
It will require the password of your MAC's admin account.  




Put this code and don't forget to change <username>:
<Directory "/Users/<username>/Sites/">
     Options Indexes MultiViews
     AllowOverride All
     Order allow,deny
     Allow from all
     Options +FollowSymLinks
</Directory>
<Directory "/Users/<username>/Sites/Projects/SenchaTouch2">
    Options +Indexes FollowSymLinks +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>


4. Test the Alias and Permissions.

a. Restart the web server.

To restart the web server, simply tick and untick "Web Sharing". 


b. Access the Sencha SDK using the Alias.
Use the URL : http://localhost/st2/sdk/
If everything goes according to plan, then you should see the documentation for Sencha Touch. CONGRATULATIONS! Otherwise, go to step 5.




5. Check the permissions of the relevant directories.

Go to Finder and navigate to all the relevant directories. Go to Get Info.


Check/Change the privileges of the user. Do not forget to restart the web service (Web Sharing).






No comments:

Post a Comment