Where to find the httpd.conf file
If your server installation has separate configuration files, you should be able to find or set this directive in the ports. Alternatively, if you want Apache to listen to ports 80 and on all interfaces regardless of the IP address, you can enter the following:. Doing so makes the server more secure and less vulnerable to attacks. Ideally, the user and group you set should not be able to login to the server ie: have no login credentials and no login shell; they will just be used for handling web client requests.
The example above uses anyUserName as our web user and group; just use a name not reserved for other processes. Next, you need to modify your config file to use the new Apache user and group.
If yours says:. Then you need to find where these variables are defined and change their values. Usually, the above directive is preceded by a comment letting you know exactly where to set the new values. Otherwise, you will just insert the new user and group name in place of the old. So your final config lines could look like this:. Any Apache directives using a relative path will, by default, append to the root path specified in ServerRoot.
When you first install your server, the configuration and log files are placed in the ServerRoot. You can change its value to a new directory, but make sure to copy the configuration files to the new location. Also, make sure you do not to add a trailing slash to the path when you modify the value. When an error occurs, Apache logs the error to a log file. The location of the error log is determined by the value specified using the ErrorLog directive. This file is critical because you will refer to it in order to debug errors, solve server configuration problems, and optimize the server.
If the server hosts multiple sites and you want to have separate error logs for each site, you can specify a different file and location for each site in the virtual hosts file. The LogLevel directive controls the level of the messages logged in the error logs. By default, it is set to warn, meaning that all messages with the value of warning and higher as in more critical will be logged. You can change the value of this directive to adjust the logging level to your preference. This is the default Apache web server document directory, and its contents are readily and publicly available to clients connecting through the web.
It contains the static and dynamic content to be served once the server receives an HTTP request for them. If you are hosting multiple websites on the same server, you need to set a different DocumentRoot for each site. This can be done within the respective VirtualHost directive that corresponds to each site. To set a separate error log for each of these domains, which is really a good idea, then your virtual hosts will like this:.
The ServerName directive is used to set the host name of the server; this is how the server identifies itself. The Apache service first starts as root in order to bind to the privileged port 80 for HTTP or if using SSL because port numbers less than are only reserved to the root user. After the initial execution, children processes spawn to handle client requests which are owned by the Apache user specified in the configuration file.
For this reason, you will find one root process and multiple processes belonging to the web user; this root process is the first one initiated when Apache starts. You can control the location of the Pid file by using the PidFile directive in the configuration file. If you open the file specified in the PidFile directive, you will find a number that corresponds to the parent process ID.
You can stop the Apache server by killing the process using its ID number. However, kill the process only as a last resort. Server loaded: APR 1. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?
Collectives on Stack Overflow. Learn more. How can I find out where the httpd. Ask Question. Asked 9 years, 2 months ago. Active 5 years, 3 months ago. Viewed 66k times. Improve this question. Add a comment. Active Oldest Votes.
Improve this answer. Best answer so far. But there're additional problems: 1 Apache might not be in system's path 2 Apache instance might not be using default values -- Honestly, I doubt it's worth the effort. Whatever the problems is, there must be a better way to solve it than parsing Apache settings files yes, there're normally more than one. Yeah, thats true, but if I would like to describe how to find config on every custom configuration I would have to write a book ; In most cases that solution should work.
But apache2 -v actually showed me the version info. This is a classic way to locate httpd. Ganatra Ganatra 5, 3 3 gold badges 15 15 silver badges 16 16 bronze badges. Thanks for this. Using the find command was the only way I could get the absolute path for the configuration file. Check the documentation! Hi, I dont seem to be able to query all the settings that are diplayed in phpinfo ;.
Ah, and obviously you can 'scrape' that setting from the html output you get from phpinfo by using a simple regex.
0コメント