Script for Monitoring Apache log file behaviour - apache

I m looking for a script which monitors apache log file and alerts the admin if there is a "GET 500" string comes or the apache log file itself stops getting new entries from a particular range of IP address.

you can use M/Monit to monitor Apache logs (and any other logs if you want). You can install and configure it on Ubuntu following the tutorial from here How to monitor Symfony and Apache logs with M/Monit, just ignore the symfony2 part and replace the string from if match "error" then alert with your GET 500 one.

Related

Apache internal server error for Perl scripts

I am installing a LAMP (Linux, Apache, MySQL, Perl) stack and I have an issue running some scripts on the web server. I have given full permissions (755) on the directories and files but still receive 500 internal server errors on some files.
See below browser console error & apache error log.
apache2.conf file:
The error is specified in the picture, together with a fix. Fix the code: remove defined from the indicated line.
See defined for details.

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

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).

How to check the server whether it is blocking POST request?

How to check whether my server is blocking the post request or not?
Currently in my wordpress, whenever I click update page there will be "The specified URL cannot be found" error. This is not permalink issue. The issue is with server configuration.
If you're getting the error message you say you're getting then POST is enabled and working. The problem is, like the message says, the URL.
Wordpress has this feature to enable "pretty URLs". It could be you've enabled it (or it may come enabled by default, I'm not sure) but don't have the required Apache module - mod_rewrite - enabled.
If you've got access to the command line of the server and your server is on Linux, simply issue:
// Enable mod_rewrite
> sudo a2enmod rewrite
// Restart Apache
> sudo service apache2 restart
If you would like some more help, please post the URL Wordpress is trying to reach and your Apache configuration to start with.
P.S.
If your server is on Windows, then enabling mod_rewrite depends on which software you've got installed.

Apache won't start on windows server

We are using Windows Server 2008 R2 Enterprise Edition. We have Apache 2.2 on it.
Whether I try to start him from the command line or via the Server Manager, I get this error
"A service specific error occurred: 1."
Google, Bing, and Yahoo found me sites that say this means that apache tried to access a file in a folder which doesn’t exist. (Is that true ?) Following that lead, more googling told me that I would find the culprit(s) in an error log file, purportedly on my server, in this subdirectory...
C:\Program Files (x86)\Apache Software Foundation\Apache2.2\logs>
There is no record of my errors in any of the files in that subdirectory. There are, however, records of errors in the error.log file from two and three weeks ago. This, despite the fact that I can create that very error as many times as I want right here and now.
Immediate question: Where do I find the log of the errors that I have been creating today ?
Real question: why won't Apache start on my Windows Server ?
In conf folder, there should be file that tells Apache which port to run on. Make sure nothing else is on that port.

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...