'suexec policy violation' prevent my website from running? - cgi

When I try to run my website it shows a 500 internal server error :
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster#example.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Error log says :
[cgi:error] [pid 13006] [client 141.101.104.167:28335] AH01215: suexec policy violation: see suexec log for more details: /home/myweb/public_html/cgi-bin/index.cgi
[cgi:error] [pid 13006] [client 141.101.104.167:28335] End of script output before headers: index.cgi
And Suexec log says :
[2016-04-23]: uid: (500/myweb) gid: (500/myweb) cmd: index.cgi
[2016-04-23]: error: target uid/gid (500/500) mismatch with directory (500/500) or program (0/0) or trusted user (0/10)
Since the problem seems from suexec I decided to check at it, so in WHM/Configure PHP and suEXEC I found it's status On, I disabled it and try to run website again but nothing changes, I enabled it again but website still cannot running.
I went to /usr/local/apache/conf/httpd.conf and removed the directive :
<IfModule !mod_disable_suexec.c>
<IfModule !mod_ruid2.c>
SuexecUserGroup myweb myweb
</IfModule>
</IfModule>
But that didn't solve the problem and the website still shows 500 internal server error
I changed te permission of /home/myweb/public_html/cgi-bin/ from 777 to 755 then to 775 but the problem still exist.
Can you help me to solve this problem.

change the permissions to 755 for all your files
and enjoy !
The problem is the un-appropriate permissions

Related

/error Directory is not accessible

In my document root I have created a directory named error and some files inside it. Whenever I try to access localhost/error, I get 403 forbidden error. There is an unanswered question about the exact same problem. The error log for the error is as following
[Sun Aug 19 09:00:52.317995 2018] [autoindex:error] [pid 3536:tid 1592] [client ::1:61437] AH01276: Cannot serve directory F:/xampp/apache/error/: No matching DirectoryIndex (index.php,index.pl,index.cgi,index.asp,index.shtml,index.html,index.htm,default.php,default.pl,default.cgi,default.asp,default.shtml,default.html,default.htm,home.php,home.pl,home.cgi,home.asp,home.shtml,home.html,home.htm) found, and server-generated directory index forbidden by Options directive
After seeing the log I came to know that the /error directory is appended to ServerRoot (F:/xampp/apache) instead of DocumentRoot (F:/xampp/htdocs). Apache is doing the above only for /error. It is working as expexted for other directories. Can someone tell me the reason and source of this problem?
Try changing the permission on the directory using chmod -R 777. I was facing the same issue and this worked for me

Preventing Apache from logging 403 errors

I want to prevent Apache 2.4 from logging 403 errors.
Conditional logging is described in https://httpd.apache.org/docs/2.4/logs.html, but this refers to the access log.
In httpd.conf, I tried:
ErrorLogFormat "%!403[%t] [%l] [pid %P] %F: %E: [client %a] %M"
Nope. I tried several variations, but Apache still gives an error. Maybe, conditional logging is not possible in the error log?

How to remove "allowmethods:error" entry in apache error_log

I have only allowed GET, POST methods in my apache server. It shows lot of times error like below which is of no use to me. How can I block these errors to come in apache error log
[Mon Aug 22 18:43:27.232168 2016] [allowmethods:error] [pid 19314:tid 139797637039872] [demowebsite.com] [client 224.0.0.0:80] AH01623: client method denied by server configuration: 'PURGE' to /var/www/demowebsite/
I also want to know what is causing it. I am using apache 2.4 + php 5.5 + mod_pagespeed + varnish.
Please help me.
Since you seem to be using Apache 2.4.X
Just by setting:
LogLevel allowmethods:crit
you will be rising the level necessary to log to error log to critical level in that module so they won't show up for errors.

Apache AuthBasic Module isn't working and recognized in Mamp

On my local system i tried to get password protecting a directory with .htaccess running on Mamp 3.0.7.2 . The Apache version Mamp uses is Apache/2.2.29 (Unix). The httpd.conf file
/applications/mamp/conf/apache/httpd.conf
contains the following active line:
LoadModule authn_file_module modules/mod_authn_file.so
My testproject in
/applications/mamp/htdocs/sandbox/testproject/admin/.htaccess
contains following lines:
AuthBasic Basic
AuthName "Admin Area"
AuthUserFile /applications/mamp/htdocs/sandbox/.htpasswd
require valid-user
the .htpasswd file was created one level beneath in the sandbox folder for testing purpose only with:
htpasswd -c .htpasswd adminuser
with pwd .htpasswd within the sandbox folder i've extracted the exact path to prevent any typos which lead to
/applications/mamp/htdocs/sandbox/.htpasswd
but when i try to access the index.php file in the admin folder i get the following in the browser:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, you#example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
and the php_error.log outputs the following on every try:
[Mon Dec 29 11:23:30 2014] [alert] [client ::1] /Applications/MAMP/htdocs/sandbox/testproject/admin/.htaccess: Invalid command 'AuthBasic', perhaps misspelled or defined by a module not included in the server configuration
But how could the AuthBasic command be misspelled or not included, cuz it actually is defined properly as shown above. :/

mod_proxy 502 Proxy Error when upload a file

I'm trying to configure the following environment: a VPS running apache and mod_proxy to proxy another server running at home (the backend). I'm able to download files but when I try to upload files the POST request fails with this error:
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request POST /upload/upload.php.
Reason: Error reading from remote server
What I don't understand is why it works for files as low as 500 bytes. And it does quickly! However, when I try to upload a tiny 4kb file, it takes forever until the error is reached. As expected, the upload works flawlessly when the backend is accessed directly, without the VPS. I tried many configurations for both sides, also tried to increase the timeout but I don't think this is the way to go. The backend has mod_access installed and it doesn't log anything when the file upload fails.
The apache logs the following:
[Thu Nov 07 22:26:03.044309 2013] [proxy_http:error] [pid 9173] (70007)The timeout specified has expired: [client 177.148.252.99:54097] AH01102: error reading status line from remote server myhome.com, referer: http://frontend.com/upload/
[Thu Nov 07 22:26:03.044423 2013] [proxy:error] [pid 9173] [client 177.148.252.99:54097] AH00898: Error reading from remote server returned by /upload/upload.php, referer: http://frontend.com/upload/
The VPS is running Apache 2.4.6 and the server running at home is a Lighttpd 1.4.32 with SSL.
The virtual host redirecting to the backend is configured as follows:
<VirtualHost *:80>
ServerAdmin webmaster#frontend.com
ServerName frontend.com
ProxyPass / http://backend.com/
ProxyPassReverse / http://backend.com/
</VirtualHost>
Front-end:
http://frontend.com/upload/
Back-end:
http://backend.com/upload/
Do you have any ideas?
The error you're seeing is due to a timeout of the proxy connection to the back-end system. You need to set the ProxyTimeout value to something larger than the default. I would recommend that you start with a value of 60 seconds and see how that works.
ProxyTimeout 60
In addition, I agree with Varghese that you want to set the environment variable in order to configure the connection to send the data in chunks. Unfortunately, there is some confusion over whether the correct setting should be, so you can try either of these:
SetEnv proxy-sendchunked 1
or
SetEnv proxy-sendchunks 1
Good luck. It's a frustrating problem.
Environment variables availables in mod_proxy:
https://httpd.apache.org/docs/2.4/mod/mod_proxy_http.html
I have faced the similar kind of issue and got resolved with the statement, I put after the ProxyPassReverse statement.
The command you have to use is : SetEnv proxy-sendchunks 1