Where can I find httpd.conf file for Apache on my windows? - apache

I am trying to fix one venerability on my production web server(Apache), Venerability is "The HTTP headers sent by the remote web server disclose information that can aid an attacker, such as the server version and technologies used by the web server"
For this I have gone for some solutions , some where I found that to solve the above Venerability we need to edit the httpd.conf file on server but I did not find httpd.conf file in my entire system (using windows 10 os) can any one please let me know hot find that file or how to resolve that Venerability on production ?

You can find httpd.conf in
installed folder ex Apache24
Apache24/conf/httpd.conf

On Windows, I have seen people run Apache from all kinds of weird and wonderful places.
You need to track down where your Apache instance is running from, normally its running as a service on windows. If you open the properties on the service and look at the Path to executable, it should be something similar to the below.
"C:\Program Files\Apache24\bin\httpd.exe" -k runservice
Or it could be
"D:\Some Application\Version\WEB\tool\SOFTS\HTTPD\bin\httpd.exe" -k runservice
Unless there is an -f flag, setting the location of the conf. There will be a "conf" folder at the same level as the "bin" folder regardless of the path. This location is set at compile time so unless you have bespoke version off Apache this should be the location.
If you are struggling to find the service or a launcher that is running Apache. You can use WMI with a WQL query to look for processes which are called httpd.exe and get its executable path.
wmic process WHERE name="httpd.exe" GET ExecutablePath

In Xampp Control panel, in apache row, click on "config" button and then you see the term Apache(httpd.conf).

Related

How can I run an index.html file on my localhost server?

I purchased a fancy little "visual menu maker" over at envato (Code Canyon) from here: https://codecanyon.net/item/z-menu-maker-drop-down-and-mega-menu/9240528
I was using their sample app where you can test out the tool and I was able to create a nice little menu for my site. But you have to purchase a license to export the code.
I purchased the license and the first "Getting Started" requirement is to "Start your Web Server and open the index.html file. This is where I'm lost. BTW... for reference, you can scroll to the bottom of that documentation page to see all the files that were included in the download.
When I try to open that "index.html" file in my browser, it doesn't load.
I followed some instructions to get my native Mac Apache server running, and everything seems to be working, with my localhost, but I don't know how to open this file through my Apache Web Server.
Any help would be so appreciated!!
I am assuming you have your Apache installed on your Mac under /etc/apache2 folder
If you want to serve your html files and related components, you need to tell apache from where to find your files
So , you need to configure apache so that it can server your files.
first you need to open an terminal from lunch menu then go to the apache2 installation directory
cd /etc/apache2
Then you need to open httpd.conf file and make necessary changes,
sudo nano /etc/apache2/httpd.conf
You will see "DocumentRoot" line/. Change it with your directory where you put your files.
Change also Directory path with yours. (It should be in same config file such as
with
<Document "some_path">
Then you should restart apache server with command
sudo apachectl restart
Now you can try to access your file . you can also check http://localhost to validate
You need to put the files somewhere within the DocumentRoot of your Apache web server, and then you should be able to visit them with http://localhost/ (assuming the index.html file is in the root of the DocumentRoot).
I'm not familiar with the default setting of DocumentRoot on the Mac port of Apache, but you should be able to find that quite easily in the configuration. On Linux that would commonly be found somewhere under /etc/apache2 or /etc/httpd.
There may be further configuration needed if the files expect some sort of server-side module to be activated (e.g. PHP), but it sounds like they are just plain HTML.
Some good answers were given but I think this particular app needed a few extra steps in order to work properly.
The developer got back to me and told me I'd need to install a MAMP solution in order to run the app.
So I installed that and then took the unzipped folder and all its contents in this folder /MAMP/htdocs/
Then when I visit http://localhost:8888/ZMenuMaker/ the app runs without a hitch!

Apache server isn't starting on Xampp portable

It may seems as a repeated question but my problem is that I couldn't be able to start Apache server on XAMPP Portable, I'm am aware of the issues that some aplications can cause since they can use the ports where apache is supposed to work, so I decide to change the apache running ports on httpd.conf and httpd-ssl.conf files to Listen on 8080 and 8001 respectively, here are some screenshots of the changes,
http-conf1, http-conf2, httpssl-conf1, httpssl-conf2
In adition to that I also chage the configuration of the "Service & Port Settings" under XAMPP Control Panel, as shown in the folowing image,
xampp-ports
Although, I did all these changes I still can´t get the apache instance running, and keep getting the following error xampp-error, it's important to notice that I´m trying to start apache service in a company workstation and I don't have any admin rights, but I read that ports above 1250 didn't need any admin rigths to run services on them, so I don´t know what to do at this point, any suggestion from you guys would be really appreciated.
Thanks.
There are lot's of answer to this problem here, in particular I think that this is the answer you are looking for:
Have you executed "setup_xampp.bat" script?
It's inside XAMPP folder and it must be executed every time you change XAMPP folder.
(Bolds are mine)
While not explicitly stated in any "immediate" and "easily" visible warning or message, this is also stated in the readme_en.txt file inside the XAMPP portable main folder.
Step 1: Unpack the package into a directory of your choice. Please start the
"setup_xampp.bat" and beginning the installation.
Note: XAMPP makes no entries in the windows registry and no settings for the system variables.
I'd also say there is a not-so-clear note section right above this step:
[NOTE: Unpack the package to your USB stick or a partition of your choice.
There it must be on the highest level like E:\ or W:. It will
build E:\xampp or W:\xampp or something like this. Please do not use the "setup_xampp.bat" for an USB stick installation!]
I've installed it in a random folder (not root) and after running the setup_xampp.bat script everything ran correctly.
If you are using xampp in USB Drive and having issue at different Windows PC/Laptop then Assign a relevant letter to USB according to installation PC/Laptop USB Letter.
Suppose You install xampp in USB at computer Alpha and Computer Alpha assign it letter F to USB and Now You are at other PC/Laptop Bravo and that PC/Laptop assign it to letter W by default then change that letter to F using Bravo system control panel.
Problem: xampp Portable won’t start, failed or just doesn’t work!
Error: Apache shutdown unexpectedly.
[Apache] This may be due to a blocked port, missing dependencies,
[Apache] improper privileges, a crash, or a shutdown by another method.
[Apache] Press the Logs button to view error logs and check... ...
Solution:
Option 2
Step 1: Open Apache "httpd.conf" from xampp control panel. The file will open in notepad.
image-xampp-config
Step 2: Scroll down or search for “ServerRoot”. If result => ServerRoot "/xampp/apache" follow next step. If not follow (Option 2)
image-xammp-ServerRoot
If 'httpd.conf' not like this image follow #Option 2
Step 3: For portable version of xampp don't any other folder name like 'xampp56'
Use only "xampp" And put this on root directory.
No Sub folder/directory
Step 4: Open your USB drive and go to xampp folder, then start the xampp-control-panel with ‘run as administrator’ mode.
Done.
Option 2
Step 1: Open your ‘My Computer’ or ‘This PC’ to confirm your USB drive label on your current PC. E:, F:, G:…
Step 2: Open Apache "httpd.conf" from xampp control panel. The file will open in notepad. Now Scroll down or search for “ServerRoot”
image-changing-file-httpd
Step 3: There’s a file address path after the ServerRoot should change with your current USB drive address path if path not matches with this current PC.
image-notepade-replace-function
Step 4: Repeat the same process for Apache 'httpd-ssl.conf', 'httpd-xampp.conf',
'php.ini'(Please note that php using the backslash “\” instead of forward slash “/”)
image-php-ini-config-update
and
{…your usb…}\xampp\apache\conf\extra\
File name: 'httpd-autoindex.conf', 'httpd-multilang-errordoc.conf'.
Note: If xampp Portable Apache "httpd.conf" like Option 2 you have to Repeat this process Every time. I recommend you to download new version of 'xampp-portable-win32-... .zip'.
Otherwise total of 7 files need to be updated everytime you change
PC!! Apache ('httpd.conf', 'httpd-ssl.conf', 'httpd-xamp.conf')
'php.ini', 'my.ini', 'httpd-autoindex.conf',
'httpd-multilang-errordoc.conf'
Step 5: Open your USB drive and go to xampp folder, then start the xampp-control-panel with ‘run as administrator’ mode.
Done.

WAMP Server 3.0.0 cannot open apache conf file

I've re-installed WAMP in order to put it into a different directory. This was mainly so everything is automatically backed up.
Mysql starts ok, but apache fails with the following message from the event viewer:
The Apache service named reported the following error:
httpd.exe: Could not open configuration file bin/conf/httpd.conf: The system cannot find the path specified. .
This file is in the correct place (C:\googledrive\wamp64\bin\apache\apache2.4.17\conf) and there isn't any other stray httpd.conf files that it might be picking up on the path or anywhere.
Any ideas?
This turned out to be a permissions problem. It seems that the system account didn't have access to the directory containing the config file, but I guess must have had enough access to start up Apache and give that helpful (not) message!

Configure Apache on Windows 7

I want to test some code on localhost before uploading to a live site. So I decided to install Apache. I'm running 64bit windows 7 enterprise edition. I downloaded httpd-2.0.64-win32-x86-no_ssl.msi. I installed it under C:\Program Files (x86)\Apache Group\Apache2
I have set domain name and server name to localhost in my installation, and used default value for all other steps. In my configuration file httpd.conf, I have ServerName localhost:80.
I followed everything I can find on online apache installation tutorials. But when I typed in localhost in my browser, I got a 404 error :(
I know it's very hard to diagnose this way, but I just wonder if someone can spot an important step I'm missing.
I'm feeling it could be something to do with my 64bit machine, and the long folder name Program Files (x86). But I have tried to install on C:\Apache directly and failed too (even got an error during installation). Can someone help?
Finally figured it out. Apache service didn't start because another system process was listening to port 80. Refer to these two posts for solutions:
http://forums.zpanelcp.com/archive/index.php/t-5265.html
http://www.softaculous.com/board/index.php?tid=1575&title=Apache_won%27t_start
Good luck to all!
Did you start the service?
Also, you should install XAMPP or WAMPP, which offers Apache, PHP and MySQL support without all the configuration hassle.
If you got a 404 error then either the webserver is running or you failed to start it and have something very wrong with the existing network config on your machine.
The latter is a lot more likely - and you can check this by looking at the logs which it has generated - there should be entries in both the access and error log.
If the problem is the spaces in the path (you'll see an error relating to the documentroot from the entries added to the error_log at startup) then (IIRC) you can either enclose the path in double quotes or use a path for the document root which doesn't have spaces - the content doesn't have to site below the directory you installed Apache into - indeed it's arguable that using a different path is good practice. Note that several versions of mod_fcgid don't like paths with spaces even if you quote them.

Is it possible to have WAMP run httpd.exe as user [myself] instead of local SYSTEM?

I run a django application over apache with mod_wsgi, using WAMP.
A certain URL allows me to stream the content of image files, the paths of which are stored in database.
The files can be located whether on local machine or under network drive (\\my\network\folder).
With the development server (manage.py runserver), I have no trouble at all reading and streaming the files.
With WAMP, and with network drive files, I get a IOError : obviously because the httpd instance does not have read permission on said drive.
In the task manager, I see that httpd.exe is run by SYSTEM. I would like to tell WAMP to run the server as [myself] as I have read and write permissions on the shared folder. (eventually, the production server should be run by a 'www-admin' user having the permissions)
Mapping the network shared folder on a drive letter (Z: for instance) does not solve this at all.
The User/Group directives in httpd.conf do not seem to have any kind of influence on Apache's behaviour.
I've also regedited : I tried to duplicate the HKLM\[...]\wampapache registry key under HK_CURRENT_USER\ and rename the original key, but then the new key does not seem to be found when I cmd this
> httpd.exe -n wampapache -k start
or when I run WAMP.
I've run out of ideas :)
Has anybody ever had the same issue?
Win+R, services.msc
edit wampapache and wampmysqld to log on as some user.
the tray icon is a convenient front end to "net start wampapache" and "net start wampmysqld"
The User/Group directives in httpd.conf do not seem to have any kind of influence on Apache's behaviour.
httpd.exe is started by the root user (this is probably why you see it running under SYSTEM). The user and group lines in httpd.conf determine what user the child processes (that httpd spawns) will run under. These forks are what actually handle page requests, etc. so it is possible that your configuration is already doing what you want it to, it is just unclear from looking at task manager.
You could also try using runas to start WAMP/Apache, though your mileage may vary.
I've just found that executing httpd.exe myself works for me... I just loose all the funky WAMP tray icon, and the "restart apache" menu item, really handy whenever I update my application code...
I'll have to make do with this for the moment...