Apache is forbidden some very specific pages - apache

I have a Sites folder inside my user directory, where I put all of my apache project files, the weird thing is that I can access all of my folders, except for the main route "localhost/" which, of course, has no index.html document on it, its just folders, but I know I should be able to see something like this:
Index of Sites.
.project1
.project2
.project3
Instead, I get this
403 Forbidden
On my new job I was assigned to this Mac PC that belonged to someone else, and this person of course needed the same tools that I have been asked to download, they told me to uninstall all of that software and install it all over again (which I did), mainly the software that I'm using is an apache server with homebrew.
I have always had this problem, but I ignored it because I thought, well, do I really need to see an "index of Sites" page when I can manually change to whatever folder I want? my answer was, not really.
But yesterday they asked me to download webpack and nodeJs, and I did, so I made a dummy project with webpack that contained all of the js and config files, but it didn't have an index.html file. And surprise surprise, I got a 403 forbidden error when entering the dummy folder in localhost.
So I'm guessing that my apache for some reason is giving me 403 errors when I do not have an index.html file or an index.php file to show.
Have you ever experienced something like this?

Related

How to disable the download of files in an Apache2 webserver?

I took over a website which I'm supposed to admin and somebody brought to my attention that certain Indexes and Files are available, which shouldn't be. I will be using dummy names.
You were able to access example.com/intern before, but I changed a line in /etc/apache2/apache2.conf according to this https://stackoverflow.com/a/31445273 . This worked partly, as I get a 403-Forbidden when I now navigate to example.com/intern and that's basically what I want.
However the directory intern governs a file called file.php.bak aswell as file.php. When I navigate to example.com/intern/file.php I get a white website. I am however not sure, if you are able to access file.php in another way, because the site does load and I don't get a 403 like before. What is way worse and the reason I am struggling with this is: If I go to example.com/intern/file.php.bak then my Browser (Firefox) offers me to download file.php.bak, which I can read in plaintext. I want all files in intern to not be accessible via the website, but I have no idea how to do this. Can anybody help?
Things I've tried:
Removing the Indexes from the apache2.conf file like mentioned above. It only puts the 403 on the directory itself and not recursively for all the files in it.
Writing a .htaccess file as described here: https://fedingo.com/how-to-prevent-direct-file-download-in-apache-server/ and putting it in intern with the same result as in 1)
Putting an empty index.html file in the intern directory. This leads to no more 403 in example.com/intern, but the download on example.com/intern/file.php.bak is still possible. I've also tried index.php with the same result.
File System:
The application runs from /var/www/application which is also the folder for the /var/www/application/index.php I want to use. The /var/www/application/intern directory is also there. While it isn't browsable anymore, the files in it still are accessible. /var/www/application/intern/file.php can be navigated to via example.com/intern/file.php, but it seems like it can't be downloaded or read as it results in a white page. /var/www/application/intern/file.php.bak can however be downloaded via example.com/intern/file.php.bak.
Let's say Apache document root is set to DocumentRoot "/folder_one/folder_two"
Placing files in a folder_one will prevent people browsing your apache server and requesting the files directly.
Place index file in folder_two and include some code such as PHP to tell apache to include whatever files you want from folder_one.
In this manor Apache will still be able to serve whatever files you want from folder_one and people will not be able to request the files directly as the are located in a directory above the Apache document root.

Apache (wamp) server redirecting to old url

I had a server running WAMP, that served many phpBB forums. The HD went dead in 2010, but recently i was able to recover the whole data.
I put the old installation dir /wamp/ on same path it was before, run wampmanager.exe, server goes up and the website and the forums work fine as they were like in 2010. However, one of them was successful, and that one specifically don't work normally.
The directory structure is:
/AllSites/Foo/
/AllSites/Bar/
/AllSites/GoodSite/
/AllSites/ is an auto-generated apache index, that shows the forum folders (Foo, Bar, GoodSite).
When i navigate to to localhost/AllSites/GoodSite/, i see the browser requesting from http://old.no-ip.url/AllSites/GoodSite, and not from localhost, until it obviously timeouts.
Naturally, i went to GoodSite's phpBB configuration to check if the old.no-ip.url was being set somewhere. Not there, and not via MySQL search for old.no-ip.url string (phpBB actually only asks for /path/, not domain). So i tried to navigate manually to http://localhost/AllSites/GoodSite/index.php and my surprise, entering like that the site works fine and always stay at localhost.
That made me abandon phpBB as the cause of the issue and focus on Apache (i can even remove index.php from /GoodSite/ and it redirects).
Next thing, i went to .htaccess in /AllSites/ and saw Redirect permanent /AllSites/GoodSite http://old.no-ip.url/AllSites/GoodSite. I removed the line, restarted server, refreshed browser cache, but nothing. It always try to go to the old url when navigating to the GoodSite folder.
So i searched for old.no-ip.url in the whole xamp directory (maybe an alias set somewhere) and subdirectories files', for no result (using Notepad++ "Find in Files" option).
So what can be causing this? The only thing that could be redirecting at server level would be apache or maybe php. But there's no such setting, as the Notepad++ search confirmed. Maybe there is something cached? I ran out of solutions. I even tried deleting the .htaccess files.

Cannot Get Index.html File Changes to be Read (Apache 2.4)

So I am at my wits end with this problem of trying to configure a simple Apache Web Server for one of my assignments. For some reason my changes to index.html are no longer being read, even though I got it to change previously.
I had this problem previously, where I would change index.html and it would still show the default "It works!" message. It ended up that, because my file extensions weren't shown, I had accidentally named the file index.html.html, and so obviously it wasn't locating it.
However, now that my file extensions are showing, I am having this problem again (the last fiasco was about a week or two ago). I tried changing the contents of index.html again, just a simple text change, and it is still loading my previous page. I have tried restarting Apache through Administrative Tools > Services since the Apache and httpd commands in the command line won't work for me. I even tried deleting the index.html file and leaving htdocs empty and it's still displaying my old web page!!!
I have no idea why it's doing this and I can't find any other answers. I checked my DirectoryRoot and DirectoryIndex values and they all point to index.html (and plus, I haven't touched httpd.conf since installation anyways). Running Windows 8.1. Any help greatly appreciated.
Modern Windows has a feature that copies some files when non-administrator edit them. You see the changes, but the service doesn't. Try editing your files as Administrator (not just someone with Administrator group privileges)

Server not servering random files

I currently run on Ubuntu 14.04.1 LTS. I'm not a server admin by any means, and just really have basic setup/config knowledge. I got a virtual box so I could learn more. Unfortunately, I just took a bit of a leap and screwed everything up.
I'm running Apache2, PHP, MySQL. This morning, I got a prompt saying I could update my server. I wasn't thinking and decided to go through with it. In addition to completely screwing up my server settings, I'm pretty sure I've lost data. But first I need to get my server running properly again (and probably never update without paying someone to do it for me).
I got most things up and running, but now when I go to my site (gamersplane.com), some paths end up 404'ing, and going to the Apache 404 instead of hitting the htaccess. The way I have it setup, the htaccess should get all files (barring things like css, js, images, xml, etc), and direct it all to a file called dispatch.php which processes the url and determines what to do/load. Basically, some stuff goes to the htaccess, other stuff isn't. I'm not sure why.
Mainly, files directly under /javascript won't load, but files in subfolders of /javascript do. In addition, going to /tools (folder exists) works, but /tools/cards (folder doesn't exist) doesn't. Strangely though, /forum (folder exists) and /forum/3 (doesn't exist) both work. I can't figure out when things do or don't work (systematically).
apache.conf: http://pastebin.com/A3J4bXE3
gamersplane.conf: http://pastebin.com/TAD06h59
Update
I found out about package called javascript-common which forces /javascript to search elsewhere. I uninstalled the package, and JavaScript is now loading. I'm told I need the package, but I don't know why.
This still doesn't solve why some other paths don't work.

Symlinks or Alias within a LAMPP setup running Joomla

Sorry for the imprecise wording of this question however I have really hit a wall here.
I have installed XAMPP/LAMPP on a machine running Debian. I then installed joomla on the installation of LAMPP. Everything is running correctly. I am now trying to add either a symlink or an Alias to the httpd.conf file. Which httpd.conf file should I edit?
I think I have somewhat correctly added something to the relevant files becuase the access log returns this:
GET /Archived/test.html HTTP/1.1" 403 1043
Obviously i'm getting 403 errors when I try to connect to the directory. I have tried applying permissions to everywhere I could think of. Any suggestions would be extremely helpful, thanks!