I am trying to set up Apache2 on my Ubuntu system. It's has been installed and working. The problem is that I'm working on an AngularJS project and I need a server for my html pages. Right now the directory is set to:
<Directory /var/www/html>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
When ever I try to change it to a specific path I always get the 403 Forbidden error. The path I want it changed to is:
/home/michael/dev/JavaScript/AngularJS/Quiz App
When the system is set to the default path and I reload my html page using Sublime Text and I get a 404 error. The html page is:
http://localhost/01_01/index.html
I've been up all night trying to fiqure this out and did the best I could to resolve it. I'm open to any possible solutions you guys may have.
It is because Apache2 does not have permission to access path within your home directory. One thing you can do is to create a symbolic link in /var/www/html and pointing it to your code directory.
ln -s "/home/michael/dev/JavaScript/AngularJS/Quiz App" /var/www/html/quizApp
No open the browser and type localhost/quizApp and you should be able to open your app in the browser
Related
I'm trying to look at Angularjs (going through Code School demo).
When I make changes to the template they are not reflected when refreshing in the browser. I have tried:
hard refreshing (and confirmed code 200 in the apache log)
deleting the browser cache (firefox)
Renaming the file on the server.
Opening in a different browser
However, copying the file to a new name on the server DOES have the changes be reflected.
regular HTML files that do not include the angular library update as normal.
Making a change to the javascript is reflected immediately (e.g. adding an alert('test')).
Is there something fundamental that I am missing here?
EDIT - Environment Details
Running on a Centos6.6 virtual box (Virtualbox) on a mac OS 10.10. Document room is /var/www/dev which is a symbolic link to /mnt/dev which I have mounted via the VirtualBox tools so I can edit the file directly on my mac
the VM config
Listen 10001
NameVirtualHost *:10001
<VirtualHost *:10001>
DocumentRoot /var/www/dev
<Directory />
Options +FollowSymLinks
AllowOverride None
</Directory>
</VirtualHost>
Take a look at this and see if the firefox answer by #hadaytullah solves your issues. I would also try it in Chrome. Probably using Angular's template caching somewhere.
This issue turned out to be a vboxsf issue as per the issue below. The changes made to the filesystem were not getting servered by apache.
https://github.com/yesodweb/wai/issues/315
Workaround: Turn sendfile off in httpd.conf
EnableSendfile off
The only way it worked for was this:
Go to firefox menu -> preferences -> advanced -> Network -> under Cached Web Content click on Clear Now.
I'm currently trying to install cake on a new site hosted on mediatemple/plesk on a shared ip. I have added the unzipped cake package to the httpdocs folder (../httpdocs/cake/), which is the server default for the site, as instructed in the cake documentation. It did not however bring me to the cake installation page, so as instructed in the cake documentation i reset the DocumentRoot for the site. The solution for document root that i found online for plesk was to set document root in vhost.conf and vhost_ssl.conf in the conf folder for the site i wanted to redirect. each of these files now has the following line of code (only code in the document):
DocumentRoot /var/www/vhosts/(mydomain.com)/httpdocs/cake/app/webroot/
As it still does not load to the cake homepage/installation page (instead i get the apache test page...) i have continued to search online and in these forums, but just keep coming up with reiterations of creating the vhost.conf and vhost_ssl.conf files as i did above (same line of code and everything)
manually directing my browser through the filepath to cake/app/webroot/ and cake/app/webroot/index.php returns only a blank page.
Is there any other way to get this to direct to the installation page correctly so that i can start to build?
DocumentRoot /var/www/vhosts/(mydomain.com)/httpdocs/cake/app/webroot/
i'd say this will not work.
Your index.php you'll need to access for cake is in "/var/www/vhosts/(mydomain.com)/httpdocs/cake/" if i'm correct.
You should remove the DocumentRoot and then browse to: mydomain.com/cake/index.php
there you should see the cake page
(this should be working before you try to set your DocumentRoot somewhere else)
When using the Views admin panel, it appears completely mispresented. Looking at the files being accessed, it turns out that the needed css files are not loaded. My Drupal installation is within a /drupal/ subfolder, and when the module is trying to access domain.com/sites/all/modules/views/css/views.css a 404 is received.
I tried browsing manually to domain.com/drupal/sites/all/modules/views/css/views.css and it works, therefore the file is there and can be accessed from the web.
The strange thing is that for other folders there is no problem, for example both domain.com/modules/user/user.css and domain.com/drupal/modules/user/user.css work. It seems like a problem with sites/ only...
I do not have CSS optimization enabled, and all folders within sites/ have a 755 permission. Is there some configuration setting I'm missing?
Apparently, the domain I'm concerned about is a parked domain (or whatever this is called) for another one, and contained in a subfolder of public_html. Drupal installation, thus, is a subfolder of that subfolder (say, /home/user/public_html/my_domain/drupal) and all requests for my domain are redirected via an .htaccess and MOD_REWRITE, to the Drupal subfolder. For some reason, it didn't have the sites/ in its regexp (modules/ and themes/ were...).
You may have incorrect vhost configuration. In order to check if this is the reason, try accessing the site without the vhost i.e. localhost/drupal and see if this works.
If it loads correctly, then you need to set up the correct document root:
<VirtualHost *:80>
DocumentRoot /www/drupal
ServerName domain.com
</VirtualHost>
Then restart apache.
For more information about how to set up vhost, visit http://httpd.apache.org/docs/2.2/vhosts/examples.html
I am trying to install typo3 as per the instructions but I have a bit of a puzzle to solve.
It seems apache denies access to any files I try to access via any symbolic link in the site root directory. I have changed permissions from SymLinksIfOwnerMatch to FollowSymLinks and no joy.
I'm working on mac OSX (SL) and installing in my user's "Sites" directory. I can access any files in this CMS directory via the web browser just not anything through symbolic links.
I hope konsolenfreddy's comment was helpful already. I am trying to round things up here:
First check if the symlinks work from terminal and/or the filesystem in general.
Also, if you use absolute paths, the whole path from root to the file in question must be readable by the Apache user. *
If yes, check if the AllowOverride option is set for your webserver (or if applyable for the virtual host) For debugging you can set AllowOverride All in either apache2.conf, httpd.conf or in sites-available/default
If yes, check if FollowSymlinks is aktivated in any of the files responsible for your webroot, starting with apache2 working yourself down to the .htaccess files.
Try changing file permissions on the symlink file and the target directory (or files)
Try creating your own symlink and see what happens when you call it in the browser.
* Check this answer at askubuntu.com for more hints.
Ok I eventually solved it. In OSX the final file that governs access of sites installed in user directories is the last Include line in the apache2/conf/extra/httpd-userdir.conffile. Once I changed that my problems went away.
Thanks to all the people that replied my questions.
I have been trying to setup cakephp on an Amazon EC2 (Ubuntu) instance ..
however when i try running the code .. it shows no color, no
styles, no layout etc.
I have updated the httpd.conf with the following content ..
Options Indexes FollowSymLinks
AllowOverride All
It still doesnt seem to work.
What is it that am doing wrong ???
Regards
Abhishek Jain
I had the same problem. Found out that my .htaccess files didn't have the permission to override anything, because AllowOverride was set to none.
I looked for the value in my httpd.conf file under /etc/httpd/conf/ and changed it to All
<Directory "/var/www/html">
AllowOverride All
</Directory>
Not EC2 related but I had a simmilar issue on the Mac when installing CakePHP on Mamp. A complete delete of all the CakePHP files and a re-install solved the issue for me.
I don't have much too much experience installing Cake, but you should probably check the following anyway:
a) Do you have the correct .htaccess files in the correct directories? Linux treats anything that starts with '.' as a system file, so you have to do
ls -a
to check if they are present. If you moved the files into the directories manually, instead of unpacking the Cake download in the location you wanted it, the .htaccess files may not have been moved.
b) Check your Apache error logs (I assume you're using apache) for errors, especially errors loading mod_rewrite. Make sure LoadModule rewrite_module libexec/httpd/mod_rewrite.so and AddModule mod_rewrite.c are specified in httpd.conf.
c) Where did you put this?
Options Indexes FollowSymLinks AllowOverride All
Without seeing more of your httpd.conf, there's no way of telling whether the Cake document root is inheriting these settings correctly.