Where is httpd.conf file of a domain? (Plesk, Apache, CentOS, Dedicated Server.) - centos

I'm trying to disable access logging (access_log) for domains. I can't find a way to do it yet, I thought if httpd.conf file exist of a domain maybe I can look into that. So do you know where is httpd.conf file of a domain?

Try
locate httpd.conf
on the commend line.
Note that in newer Apache setups, the configuration is spread across multiple files, but they won't be far from where you find httpd.conf.

I had the same problem, but reading #user1055645 comment in the question, about follow the file:
/etc/httpd/conf.d/zz010_psa_httpd.conf
I found the configuration file here:
/etc/httpd/conf/plesk.conf.d/vhosts/domain.com.conf
If you want to disable access_log you can edit this file and comment with an # the beginning of this line:
CustomLog /var/www/vhosts/system/giornalone.it/logs/access_log plesklog
At the end restart apache server to make the changes take effect.

Related

Change default directory for website in Amazon EC2 Linux instance

I want to be able to install a Zend - based site on Amazon EC2 Linux instance. To be able to do that, I need to have the main directory name as "public" rather than "html" as is default for EC2.
How can I change the path to the site's default directory from /var/www/html/ to /var/www/public/ ?
Thank you in advance for your help!
Oliver is on the right track. You need to do 2 things:
Update the DocumentRoot statement within the httpd.conf file to your new home directory.
Restart your web service for the change to take effect.
So for example, do the following command:
sudo vi /etc/httpd/conf/httpd.conf
Then look for the following line by typing /DocumentRoot + ENTER in the vi editor:
DocumentRoot "/var/www/"
Now just change the document root directory to whatever you want.(In the vi editor, move the cursor where you want it, press i to switch to insert mode, modify the code, then press ESC to get out of insert mode.) You can (and probably should) also change any <Directory statements that immediately follow, as these relax some access standards and shouldn't apply at a level above your web root. For example, you may see this:
#
# Relax access to content within /var/www.
#
<Directory "/var/www">
I recommend changing this to:
#
# Relax access to content within /var/www/html/drupal.
#
<Directory "/var/www/html/drupal">
Changing the comment is purely for consistency should anyone else review your code later. There are probably at least 2 statements that fit this pattern in the file, so look for and change them.
Save your changes when finished by typing :x and pressing ENTER.
Finally, a crucial step: restart your web service! This is a commonly overlooked step. The command will vary based on your server setup, but will probably be very close to:
sudo service mysqld restart
Check your website when finished to make sure it's going to the right default folder when you just use the domain name with no additional folders. Good luck!

Apache2 reload config from inside the CGI

I am working on a simple Perl app that copies another Perl app and builds all the required Apache config files.
The thing I can't seem to figure out is how to reload the apache config on the fly. I know I could do a system call and reload apache there, but that would mean I would have to get root access to this app, and that is a little scary.
Is there a way to ask apache to reload its config files from within the CGI container?
-------------------------Additional info------------------------------
I have done some more research and the problem is that Apache must be run with elevated privileges to bind to port 80. So one solution would be to set Apache to run on another port and forward that port to 80 via iptables. (This may be a last resort but a very messy solution).
Here is what gets me, Apache should be able to maintain its current port bindings and recheck its config files, all I am doing is adding another script alias.
Is there any way to add a new script alias with out a reload?
you also have the options to reload the config:
/etc/init.d/httpd reload
or
apachectl -k graceful
But unfortunately, those need root also. This differs from a normal restart in that currently open connections are not aborted. A side effect is that old log files will not be closed immediately. This means that if used in a log rotation script, a substantial delay may be necessary to ensure that the old log files are closed before processing them.
Also, if running Apache with daemontools you can do this by:
svc -h /service/apache
Sorry to ask a question then not give some one else the opportunity to answer but I figured out a solution and I hope it may help some one else.
What I had to do was leave the config alone it is not possible to reload in the manner that I required with out root privileges or some fancy port forwarding (That would make this application less portable than I would like).
So the only thing that Apache appears to load dynamically is the file system.
What I have done is used mod_rewrite to redirect the script requests and simply put them in /var/www/appname/copyname/cgi-bin/

Configure Apache2 to allow clients to run Perl Scripts in cgi-bin

I have two perl scripts; one acts like the client (and queries); the other acts like the server and returns information. On an Apache server (not my own) they work perfectly.
However, on my ubuntu/Linux_box with Apache2 (that I set up) they do not; I get a 404 not found error. The cgi-bin directory is located at usr/lib/cgi-bin. What specific files/settings etc have to be changed/altered/etc. And, what specific changes/alterations/etc. need to be made?
Edit:
I changed the httpd.conf and tried both of the following (but neither worked):
ScriptAlias /diag/ /usr/lib/cgi-bin
ScriptAlias /diag/ /usr/lib/cgi-bin/
I am using a perl script as the client, and it did not work. For illustration purposes I attempted to locate the file with the browser shown in the 2nd pic.
If they are receiving 404, it means that the file does not even exist in the correct location. In the httpd.conf look for the "ScriptAlias" directive that has an entry for cgi-bin, should be something like
ScriptAlias /cgi-bin/ /some_folder/cgi-bin
Once you know the correct folder, the 404 error should go away.
Two other points -
1. For cgi files, ensure that the execute bit is set.
2. Verify that the location of perl matches the one in the perl script.

using directadmin resetting counter in counter.pl script running on website

my client side has counter.pl script running on homepage. that displays visitors counter
the client wants to change the visitor counter value.
when i checked the code in index.html,it points cgi-bin/counter.pl script
But wen i try to search cg-bin folder ther are only two files counter.jpg and .htaccess
now how to find the counter.pl script and edit ...!!!??
thanks in advance for any help
Check the web server configuration to see where the cgi-bin directory really is. If you're using apache then you want to look for something like this:
ScriptAlias /cgi-bin/
in the httpd.conf and related files. The actual cgi-bin directory is often located somewhere outside the DocumentRoot directory.

How do you use the Apache "ScriptInterpreterSource Registry-Strict" directive?

i run Apache web server on windows in order to work on some Perl CGI scripts. in production these scripts run on a linux box, and in the source code repository they all have shebangs like: #!/usr/bin/perl, but on my windows machine the shebangs would be #!c:\perl\bin\perl.exe, so i have a conflict with the source code base.
enter the Apache ScriptInterpreterSource directive.
i've been trying to make it work, based on what i can google. but so far no luck. i have:
added these things to the appropriate directive
AllowOverride None
Options Indexes FollowSymLinks ExecCGI
Order allow,deny
Allow from all
ScriptInterpreterSource Registry-Strict
added:
AddHandler cgi-script .cgi
edited my registry and added a new String to
HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command=C:\Perl\bin\perl.exe
now, i know that CGIs work on this server as long as they have the right shebang.
but when i try to access a CGI without a shebang the apache log spits out:
No Exec CGI Verb found for files of
type '.cgi'
any thoughts, insights, or even wild-ass guesses would be appreciated.
thanks.
It sounds like the ScriptInterpreterSource line is being ignored. If it's set to Registry or Registry-Strict, it should ignore the shebang lines and use the registry only.
Also, the Apache 2.2 docs have a slightly different location for the registry key:
HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command\(Default) => C:\Perl\bin\perl.exe -wT
This works for Python scripts as well. I did the following to fix my Apache install to ignore the shebang requirement in my scripts. Without this the shebang is required in the current version of Apache 2.4 - or at least it was in mine.
# tell apache to use registry - this requried a registry hack
# to the following:
# [HKEY_CLASSES_ROOT\.py\Shell\ExecCGI\Command] = "c:\\python\\python.exe"
ScriptInterpreterSource Registry-Strict
Instead of running your perl code in separate CGI processes, consider using mod_perl (See http://perl.apache.org).
Mod_perl is a lot more efficient, as the Perl code is loaded and parsed only once and then runs directly within the Apache processes with no need to start or communicate with other processes.