We have an Apache Webserver, Version 2.4.12 on a Windows 2008 machine.
We have gif images in different sub folders of htdocs, some in "icons" and some other in "ni5/customer/images".
When I start our web application, the Google Chrome developer tools show something strange:
The one gif image from "ni5/customer/images" is loaded and the type is "gif", the other gif image from "icons" is NOT loaded and the type is "text/html".
When I open the second one with a image viewer, it is recognized as "gif".
The second image is not found on the server on that location or under that name.
It results in a 404 not found error(that's why the 404 response code is there).
The 404 not found response is usually always a text based response served from the defined error pages.
Just make sure you have the path and filename correct. Might be the result of a simple typo.
It was a name conflict!
I typed in the browser "http://localhost/icons/aktansicht3.gif" and found nothing.
Then I change "icons" into "icons2" and typed
"http://localhost/icons2/aktansicht3.gif" and it was found.
In Apache conf there was the entry:
Alias /icons/ "C:/xampp/apache/icons/"
So the "icons" directory was redirected to another location.
Now the alias is deleted from the conf and everything works.
Related
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.
After an installing a new SSL certificate and changing the PHP version from 5.x to 7.1.28 product images are not shown in the frontend anymore, Chrome dev tools show a 404 error for the image files.
They are visible in the backend under product catalog.
It looks like if the image directory is missing, i.e. something like /home-default/ because in the HTML code the image file is supposed to be directly on the document root directory, which obviously is wrong.
When I switch off "Friendly URL" the images are shown.
What I tried so far:
Deleted .htaccess, switched Friendly URL to on to regenerate the .htaccess
Emptied cache and regenerated the image thumbnails
Switched back to PHP 5.4
Added AllowOverride All to the vhost config
Nothing helps. On the server is another PrestaShop installation, running same PrestaShop version 1.6.18 also under PHP 7.1.28, there the "Friendly URL" works fine.
I must say I have no clue where to look after this problem.
After spending some time with #Harry, debugging his configuration, we found the solution and I'm sure this will help many others.
#Harry was using a combo with Nginx + Apache.
We checked his PrestaShop .htaccess file and made sure RewriteEngine was on and triggered properly (e.g. the pages were properly rewrited, only the images were not) - everything was OK.
We tried to write ourselves a basic RewriteRule to redirect a .jpg and it did not work, showing an Nginx 404 page.
We came to the conclusion Nginx was handling all the static content (JS, CSS, JPEG, etc.) and not forwarding it to Apache.
Solution
We removed this part from the Nginx configuration:
location ~ ^/(.*\.(ac3|avi|bmp|bz2|cue|dat|doc|docx|dts|eot|exe|flv|gz|htm|html|img|iso|jpeg|mkv|mp3|mp4|mpeg|mpg|ogg|ppt|pptx|qt|rar|rm|swf|tar|tgz|ttf|txt|wav|xls|xlsx|zip))$ {
try_files $uri #fallback;
}
As a general advice, I would suggest not using Apache+Nginx, PrestaShop works very well with Nginx+PHP-FPM already and you will get great performances.
If you choose this solution, don't forget to set your PrestaShop rewrite rules directly in Nginx (Example).
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?
We have set up apache server and created a symbolic to logs folder.
Problem:
When we try access the logs using http:/server:port/logs the logs appear properly in browser. However when we are using big ip url that is http:/bigipurl/logs url rewrites as http:/bigipurl:port/logs and the page doesnt get displayed.
Observation:
If we use http:/bigipurl/logs/ logs are getting displayed.
Figured this out, Added directoryslash off under the respective directory section in httpd.conf file.
so, I'm running Apache on my laptop.
If I go to "localhost", I get the page that says,
If you can see this, it means that the installation of the Apache web server software on this system was successful. You may now add content to this directory and replace this page.
except, I can't add content and replace that page.
I can click on its links, and that works fine.
First of all, there's not even an "index.html" document in that directory. If I try to directly access one that I created with localhost/index.html, I get "the request URL was not found on the server." So, I'm not even sure where that page is coming from. I've searched for words in that page under the apache directory, and nothing turns up. It seems to redirect somewhere.
Just as a test, I KNOW that it loads localhost/manual/index.html (doesn't matter what that is) so I tried to replace that with something I've written, and I received the message
The server encountered an internal error or misconfiguration and was unable to complete your request.
The error log says,
[Fri Sep 12 20:27:54 2008] [error] [client 127.0.0.1] Syntax error in type map, no ':' in C:/Program Files/Apache Group/Apache2/manual/index.html for header \r\n
But, that page works fine if I open directly with a browser.
so, basically, I don't know what I don't know here. I'm not sure what apache is looking for. I'm not sure if the error is in my config file, my html page, or what.
Oh, and the reason I want to open this using apache is (mainly) because I'm trying to test some php, so I'm trying to get apache to run locally.
Thanks.
"By default, your pages should be placed in the "C:\Program Files\Apache Group\Apache2\htdocs" folder for Apache 2.0 and the "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs" folder for Apache 2.2. When your site is ready, simply delete the existing files in the folder and replace them with those you want to test."
From here.
OK,
To answer my own. . .I found that the "Listen" directive in the configuration file had been set to "Listen 80" instead of "Listen localhost: 80".
Also, localhost/htdocs/index.html doesn't work, but localhost/index.html does.
Hopefully this can help someone in the future.
Thanks, Schroeder.
If you have Skype it also uses the same ports(80, 443) as Xampp does. So start Xampp first and then Skype.
[source: http://starikovs.com/2011/02/23/apache-doesnt-start-in-xampp/]