http://mallinson.ca/post/osx-web-development/
I was following the above guide for setting up the OS X Mavericks local development environment on my new mac and originally everything worked out. Not really sure what happened afterwards, but after leaving my computer for sometime, working on other stuff, and maybe rebooting, I now get a Forbidden -- You don't have permission to access / on this server. (403 Forbidden in title bar) when I try to go to ANYTHING.dev, localhost, 127.0.0.1, etc. Since I didn't change any of the files mentioned in the article since it was last working, my guess is this is some sort of permissions issue.
The only file from this entire setup that is different than what is in the guide is httpd-vhosts.conf found in /private/etc/apache2/extra/, which was simply changed to match my directories rather than the author's. Just in case, you can view the file here -- http://pastebin.com/wcr1fdZe (I have 2 hard drives, SSD boot and HDD for storage and named storage, so I found it reasonable to put the www directory on the HDD)
By the way, that directory is as follows /Volumes/Storage/www/sites/home/wwwroot where sites is the only folder in www and home is the only folder in sites and wwwroot is empty.
Can someone please help me fix this?
Note: I actually also tried going through this guide earlier and it worked originally and then it failed randomly with the same 403, so I reinstalled OS to see and it worked and failed again in a similar manner. I have tried flushing dns cache and restarting apache server via terminal. I'm new to this stuff so please provide specific commands, paths, etc. when something needs to be done, and ask if you need more details.
> UPDATE: so #matanco has got this figured out for me if you look below, but there's still ONE problem... localhost is working, BUT home.dev, me.dev, anything.dev,etc. still has 403
just follow those steps this is simple permission issue:
cd /usr/local/apache2/htdocs/ (if you changed it navigate to your folder)
chmod 644 .
chmod +x .
hope that will solve your problem.
EDIT::
add this to your httpd-vhosts.conf
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents/
</VirtualHost>
Related
I have been searching for hours now and I cant find a solution. I have tried much to many things to even start listing the things. So please any assistance would be appreciated.
I have changed the htdocs folder location in httpd.conf because I have all my files sync to cloud storage. This works perfectly on my windows machine but on linux not so much. Every thing runs perfectly but when I try to access my htdocs folder (new location) I get a message:
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.48 (Unix) OpenSSL/1.1.1k PHP/8.0.10 mod_perl/2.0.11 Perl/v5.32.1
But When I change the location back to the normal location it works perfectly.
I have already gave full access to the folder.
Think of a directory structure as a series of security doors:
/var
/www
/htdocs
If you give someone a key to htdocs (i.e. set the permissions to give a user access) then they can open that door… but only if they can get to it.
If you don't also give them keys to www and var then they can't get into htdocs.
I'm experiencing the problem discussed in this thread: New xampp security concept: Access Forbidden Error 403 - Windows 7 - phpMyAdmin
To solve it I apparently need to make some changes to the httpd-xampp.conf file. I however don't know how to locate it.
Are you guys sure you mounted /lampp?
XAMPP Volumes
If not, please do so.
Then open file at
lampp/etc/extra/httpd-xampp.conf
and edit it at line 20 and add a new one at 42 like this:
# since XAMPP 1.4.3
<Directory "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
Require all granted
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
and
# <Location /time>
SetHandler modperl
PerlResponseHandler Apache::CurrentTime
Require all granted
Start XAMPP again (mounting of lampp not necessary anymore) and you are good to go.
use find command to know the location of httpd-xampp.conf. enter the following command:
$ sudo find / -iname "httpd-xampp.conf"
Is not that located at: etc/extra/httpd-xampp.conf ?
If not, then just create it, and in the main .conf file (httpd.conf) file, insert such line:
Include etc/extra/httpd-xampp.conf
It is located in the virtual machine running xampp, not the physical hard drive. That being said, I cannot find mine either and am simply using http://localhost:8080 to access phpMyAdmin until I find httpd-xampp.conf.
Having issues setting up xampp on macOs or accessing the config.inc.php or httpd-xampp.conf file.
Note: For macos xampp making use virtual machine under the hood to mount the folder structure on your system.
step 1: you need to follow the instruction step by step on the screen below,
it has image illustration which helps alot
https://www.apachefriends.org/blog/new_xampp_20170628.html
step 2: Click on network tab within the xampp interface then enable one of the
host machine.
step3: Click on the volume tab within the xampp interface then click on mount
then click Explore to have access to the xampp folder or files likes of config.inc.php or httpd-xampp.conf
Maybe some one know the solution for my problem.
In localhost all works fine.
I bought vps server, install Ubuntu, and LAMP stack in it.
And now copy all files from localhost to live server, threw ftp.
I write ip/public in web browser and I see my projects mine path running well, but if I wanna go to url like ip/public/login it throws 404 error. (Now working only public address)
.htaccess in public folder is good.
Now I find If I write ip/public/index.php/login it works well, but I need that it work like in localhost
Try making a symbolic link to your public folder and using that as the URL of your project. For example, I have a project called inspections in my /var/www/html folder. If I try to access http://url/inspections I get an error:
403 Forbidden: You don't have permission to access /inspections/ on this server.
However, after calling this command:
ln -s /var/www/html/inspections/public /var/www/html/insp
And navigating to http://url/insp the page displays properly and everything works fine.
Another thing to keep in mind is that app/storage need to have write access (at least) in order for Laravel to work properly. I usually just do:
sudo chmod 777 -R app/storage
To activate all privileges and go from there. Hope that helps!
Also did you check if mod_rewrite is enabled on this server?
Maybe Overwrite is not defined for this folder?
Try:
<?php in_array('mod_rewrite', apache_get_modules()); ?>
Or this:
<?php die("Enabled: ". strpos(shell_exec('/usr/local/apache/bin/apachectl -l'), 'mod_rewrite') !== false); ?>
And check if Allowoverride is enabled in your virtual host file.
The location of the file depends on the operating system and structure.
It should look a little like this:
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
I've been trying to get a cakePHP app to run on a Debian Server. It works find on localhost, using WAMP. At first I had issues with the rewrite not working. So I attempted to fix that by changing the owner of some of the folders to www-data, from root, as I read in other places on the internet that that would help. I changed the root of the cakephp app to www-data, and everything under that to www-data (recursively). But this still did not fix it.
So I went to instructions for if you can't get url rewriting working, by doing the following...
So I found some other instructions that said to get rid of the ./htaccess, /app/.htaccess and /app/webroot/.htaccess files, which I did.
And I uncommented the following lines in my cakephp folder:
Configure::write('App.baseUrl', env('SCRIPT_NAME'));
Configure::write('App.fullBaseUrl', env('SCRIPT_NAME'));
Configure::write('App.imageBaseUrl', 'img/');
Configure::write('App.cssBaseUrl', 'css/');
Configure::write('App.jsBaseUrl', 'js/');
Now I'm getting this error:
Missing Controller
Error: CakeController could not be found.
Error: Create the class CakeController below in file: app/Controller/CakeController.php
<?php
class CakeController extends AppController {
}
Notice: If you want to customize this error message, create app/View/Errors/missing_controller.ctp
Stack Trace
APP/webroot/index.php line 108 → Dispatcher->dispatch(CakeRequest, CakeResponse)
ROOT/index.php line 41 → require(string)
I think I have to change the App.baseUrl or the App.fullBaseUrl, to something else, but I am not sure to what.
The root of the application is in / <root>/home/webdev/webroot/Cake, and the public domain is located in / <root>/home/webdev/webroot. I think that info may be relevant to solving the problem.
Any help would be much appreciated. Thankyou
You seem to be lacking basic knowledge of setting up the server which leads me to think that you might have mixed up lots of different "workarounds" in your way of trying to make it work, such that it might be too difficult to fix it now through this.
If you have root access to the debian server I assume you're talking about a VPS you own. Then you most probably can reset it to a fresh install and start over.
So first things first:
You're developing on windows and will be serving your app on unix (linux). Beware windows is case insensitive and unix is not, if you don't follow conventions you'll definitely end up with this issue at some point (i.e. webroot/Cake or webroot/cake are the same thing to windows but different on unix).
By default you can't have Apache serve files from from user home folders (/home/user/...) but from /var/www. If you want it the first way you need to set it up properly, which would mean to know how to create an apache site config file and/or messing with apache's main config file. I would leave that for later if I were you.
The folder/files in any folder that Apache must serve need to be accessible/readable by www-data user or group. Exception is the application's tmp folder that need to also be writable by the same user or group. If you put them on /var/www/app you can chown www-data:www-data /var/www/app -Rwhich will save you lots of time in your way to make things work at first.
By default Apache doesn't come with rewrite enabled. You need to a2enable rewrite && service apache2 restart. You will also need to check the directive AllowOverride" in /etc/apache2/sites-available/000-default.conf under directory /var/www/ to make sure it is set to AllowOverride All. If not amend and restart apache.
If you apply the above you should be able to properly access your app under http://server_name/app and follow on from there.
I have a folder in my root MAMP directory, "site". I have that symlinked to a folder in ~/Documents/Dropbox/site, so whatever happens in "site" gets transferred to Dropbox.
However, when I do this, I get a 403 forbidden error when trying to view localhost/site- is this a problem because I'm using PHP and I should fix php.ini, or is this an httpd.conf problem?
In httpd.conf, I have AllowOverride set to None.
Thanks for any answers in advance.
There's also the FollowSymlinks option in Apache, which is generally disabled by default. You can enable it by doing
Options +FollowSymlinks
This is a bit hacky, but I had this problem before and while the solution didn't necessarily make a whole lot of sense, it worked for me:
sudo su <username> to assume the user (eg, if your webserver is running as nobody, use nobody
If #1 is a user whose shell is something similar to /sbin/nologin, temporarily use usermod to change their shell to something you can use, like /bin/bash, before sudoing as them
Symlink as the user instead of root or whatever user this was done as previously
Reset any changes made in #2
Since symlinks are by default 0777, any normal process has read access provided that the destination directory is also of sufficient permissions (0644 would be fine) - for some reason Apache gave me problems with that to. Once I created the link as the user in question, it worked like a charm. HTH!
Edit: also, this almost goes without saying, but I'm assuming you verified the link yourself via a terminal to make sure that the link is correct, right?