localhost/phpmyadmin 404 error - apache

I have installed phpmyadmin, but doesn't seem to work.
I have apache2, php5, php-cgi, mysql-server, mysql-client installed too.
I've added the next line to the apache2.conf file:
#include phpmyadmin
Include /etc/phpmyadmin/*.conf
But when I restart the server, I have the next error:
* Restarting web server apache2 [fail]
* The apache2 configtest failed.
Output of config test was:
AH00526: Syntax error on line 2 of /etc/phpmyadmin/lighttpd.conf:
Invalid command 'alias.url', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
And the error log says:
[Tue Aug 13 12:36:25.690262 2013] [mpm_prefork:notice] [pid 13210] AH00163: Apache/2.4.6 (Ubuntu) PHP/5.5.1-2+debphp.org~precise+2 configured -- resuming normal operations
[Tue Aug 13 12:36:25.690358 2013] [core:notice] [pid 13210] AH00094: Command line: '/usr/sbin/apache2'
[Tue Aug 13 12:39:21.635566 2013] [mpm_prefork:notice] [pid 13210] AH00169: caught SIGTERM, shutting down
What should I do to define alias.url, or what am I doing wrong? Thanks

Solved with #Jamie Taylor comment: try changing *.conf to apache.conf.
Then get 403 response forbidden, and solved it by adding:
Order allow,deny
Allow from all
to
<Directory "/usr/share/phpmyadmin"> </Directory>
in /etc/phpmyadmin/apache.conf
And don't forget to uncomment:
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
in /etc/phpmyadmin/config.inc.conf, if you want to use PHPMyAdmin without password (only localhost, of course).

Related

`http.service` fail to start with `exit-code` or `protocol`

I'm configuring a new Apache web server on Oracle Linux 9 (comparable with RedHat/CentOS according to Oracle). The version of httpd is 2.4.51 and the version of php is 8.0.13. However, the service failed to start with the following error (with journalctl -xeu:
httpd.service: Failed with result 'exit-code'.
I look up and many of similar error appear related to config file. But apachectl configtest returned Syntax OK, httpd --help give no output.
So I tried to comment out some config in http.conf, after commenting out the mod-security related line, it throws out new error message:
httpd.service: Failed with result 'protocol'.
No other useful error message can be retrieved from journalctl.
Commenting out the php related lines also doesn't help. Besides, I found that to install mod_security2 I have several other "module" to install, but I download this mod_security2 from aap stream. To make sure the problem does not come from this module, I installed the required modules (except libapr and libapr-utilbecause error occurs on building, therpmbuildcannot finddoxygen` even though I installed it) that are required in its documentation.
—————Update————
error_log:
[core:notice] [pid 4944:tid 4944] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[suexec:notice] - - AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)AH00016: Configuration Failed
[core:notice] [pid 4963:tid 4963] SELinux policy enabled; httpd running as context unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[suexec:notice] - - AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[-:error] - - SecServerSignature: original signature too short. Please set ServerTokens to Full.
[-:notice] - - ModSecurity for Apache/2.9.3 (http://www.modsecurity.org/) configured.
[:notice] [pid 4963:tid 4963] ModSecurity: APR compiled version="1.7.0"; loaded version="1.7.0"
[:notice] [pid 4963:tid 4963] ModSecurity: PCRE compiled version="8.44 "; loaded version="8.44 2020-02-12"
[:notice] [pid 4963:tid 4963] ModSecurity: LUA compiled version="Lua 5.4"
[:notice] [pid 4963:tid 4963] ModSecurity: YAJL compiled version="2.1.0"
[:notice] [pid 4963:tid 4963] ModSecurity: LIBXML compiled version="2.9.12"
[-:notice] - - ModSecurity: Original server signature: Apache
[:notice] [pid 4963:tid 4963] ModSecurity: Status engine is currently disabled, enable it by set SecStatusEngine to On.
[lbmethod_heartbeat:notice] - - AH02282: No slotmem from mod_heartmonitor
[-:error] - - SecServerSignature: original signature too short. Please set ServerTokens to Full.
[core:notice] - - AH00094: Command line: 'httpd'
AH00016 seem to be related with ssl cert, so I also attached the error log for ssl.
ssl_error_log:
[ssl:emerg] - - AH02562: Failed to configure certificate www.example.com:443:0 (with chain), check /etc/pki/tls/certs/example-wildcard.crt
[ssl:emerg] - - SSL Library Error: error:8000000D:system library::Permission denied (calling fopen(/etc/pki/tls/certs/example-wildcard.crt, r))
[ssl:emerg] - - SSL Library Error: error:10080002:BIO routines::system lib
[ssl:emerg] - - SSL Library Error: error:0A080002:SSL routines::system lib
I found a permission denied error to read my wildcard cert, and I noticed it was because I have the wrong ownership. I changed to what it should be, with a right of 644.
BTW, httpd -t also returns Syntax OK.
Now that I rerun httpd -t with no root right returns error to file permission (solved by changing the ownership to apache):
# sudo -u apache httpd -t
AH00526: Syntax error on line 39 of /etc/httpd/conf.d/mod_security.conf:
ModSecurity: Failed to open debug log file: /etc/httpd/logs/modsec_debug.log
Weird enough, when I check port listener I saw:
$ sudo netstat -punta | grep LISTEN
tcp6 0 0 :::443 :::* LISTEN 4964/httpd
tcp6 0 0 :::80 :::* LISTEN 4964/httpd
httpd is listening when it failed to start?
Maybe SELinux is denying access, probe this:
restorecon -vF /etc/pki/tls/certs/example-wildcard.crt

Apache/XAMPP does not give access to subdirectory

I set my document root to a git repository of three.js, and the root directory lists all subfolders, except examples/. It also doesn't list files and folders starting with . (understandable, I guess) and README.md. Trying to access examples directly gives a 503 error.
There are no .htaccess files anywhere. There is no IndexIgnore anywhere. Error.log lists this:
[Sat Jun 02 13:35:08.169886 2018] [proxy:error] [pid 20844:tid 1996] (OS 10061)No connection could be made because the target machine actively refused it. : AH00957: AJP: attempt to connect to 127.0.0.1:8009 (127.0.0.1) failed
[Sat Jun 02 13:35:08.169886 2018] [proxy:error] [pid 20844:tid 1996] AH00959: ap_proxy_connect_backend disabling worker for (127.0.0.1) for 5s
[Sat Jun 02 13:35:08.169886 2018] [proxy_ajp:error] [pid 20844:tid 1996] [client 127.0.0.1:57788] AH00896: failed to make connection to backend: 127.0.0.1
In your apache conf folder, see if you have a file named /extra/httpd-ajp.conf with a line like this:
ProxyPass /examples ajp://127.0.0.1:8009/examples smax=0 ttl=60 retry=5
If so, comment out or delete that line. Fixed the problem for me.

Custom error log in apache2

In apache log file I am getting long messages such as:
[Wed Feb 21 19:32:18.916451 2018] [:error] [pid 23919] [client 10.0.2.2:50156] Error Message...
How I can get custom log message like:
Format:[Time] [Message]
[19:32:18] Error Message....
Put
ErrorLogFormat "[%{c}t] %M"
in apache config file (supposedly, /etc/apache2/apache2.conf)
Other formatting options you can find in https://httpd.apache.org/docs/2.4/mod/core.html#errorlogformat

503 Error On Fedora 22 Server Using Apache 2.4 and Mono

I am currently attempting to setup a home webserver. I have a lot of experience programming in C# and have been using Visual Studio and IIS for years. I recently decided to make the move to Linux and have been rebuilding my code bases using MonoDevelop. I have them compiling on my development machine, so I am setting up a home server with Fedora 22 Server, and Apache 2.4.
Using nothing but the default configuration the server is able to serve html pages without a problem, but when I installed Mono, and its dependencies, I have been getting various errors, and they are not detailed enough for someone with my limited experience to resolve. I have spent the entire week working on the issue, and here is where I am stuck.
When browsing to http://71.41.214.194/LDC-Demo/index.aspx, I get a "503 Service Unavailable" error in the browser. When looking at the Apache Error log I get the following:
[Fri Oct 09 15:22:41.809588 2015] [:error] [pid 7577] Failed to connect to mod-mono-server after several attempts to spawn the process.
Since that is not enough to discern the issue, I restarted Apache and tried to reload the page (I was hoping for a related error that could help me chase down the problem)
[Fri Oct 09 15:38:22.000257 2015] [mpm_prefork:notice] [pid 7564] AH00170: caught SIGWINCH, shutting down gracefully
[Fri Oct 09 15:38:23.011225 2015] [:alert] [pid 7564] (13)Permission denied: Failed to acquire dashboard lock before destroying the dashboard
[Fri Oct 09 15:38:23.011668 2015] [:alert] [pid 7564] (13)Permission denied: Failed to acquire dashboard lock before destroying the dashboard
[Fri Oct 09 15:38:23.011770 2015] [:alert] [pid 7564] (13)Permission denied: Failed to acquire dashboard lock before destroying the dashboard
[Fri Oct 09 15:38:24.068911 2015] [core:notice] [pid 7641] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Fri Oct 09 15:38:24.069933 2015] [suexec:notice] [pid 7641] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globa$
[Fri Oct 09 15:38:24.079961 2015] [auth_digest:notice] [pid 7641] AH01757: generating secret for digest authentication ...
[Fri Oct 09 15:38:24.080817 2015] [lbmethod_heartbeat:notice] [pid 7641] AH02282: No slotmem from mod_heartmonitor
[Fri Oct 09 15:38:24.088966 2015] [mpm_prefork:notice] [pid 7641] AH00163: Apache/2.4.16 (Fedora) mod_mono/3.12 configured -- resuming normal operations
[Fri Oct 09 15:38:24.088993 2015] [core:notice] [pid 7641] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Fri Oct 09 15:38:36.414478 2015] [:error] [pid 7651] Failed to connect to mod-mono-server after several attempts to spawn the process.
After researching each of these messages to the best of my ability, I could not find anything that was related to the issue. I did find that I could see some more details if I ran the command "journalctl -xe -cat".
Started The Apache HTTP Server.
mono[7646]: segfault at 5 ip 0000000000512710 sp 00007fffa85f01b0 error 6 in mono-sgen[400000+34d000]
<audit-1130> pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=httpd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Unregistered Authentication Agent for unix-process:7633:25881589 (system bus name :1.83, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
<audit-1400> avc: denied { execmem } for pid=7649 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1400> avc: denied { execmem } for pid=7649 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1701> auid=4294967295 uid=48 gid=48 ses=4294967295 subj=system_u:system_r:httpd_t:s0 pid=7649 comm="mono" exe="/usr/bin/mono-sgen" sig=11
mono[7649]: segfault at 5 ip 0000000000512710 sp 00007ffe5ca30440 error 6 in mono-sgen[400000+34d000]
Not saving repeating crash in '/usr/bin/mono-sgen'
Not saving repeating crash in '/usr/bin/mono-sgen'
<audit-1400> avc: denied { sigchld } for pid=7647 comm="abrt-hook-ccpp" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=process permissive=0
Failed to create core_backtrace: waitpid failed: Permission denied
Blacklisted package 'mono-core'
'post-create' on '/var/spool/abrt/ccpp-2015-10-09-15:38:24-7644' exited with 1
Deleting problem directory '/var/spool/abrt/ccpp-2015-10-09-15:38:24-7644'
<audit-1400> avc: denied { execmem } for pid=7661 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1400> avc: denied { execmem } for pid=7661 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1701> auid=4294967295 uid=48 gid=48 ses=4294967295 subj=system_u:system_r:httpd_t:s0 pid=7661 comm="mono" exe="/usr/bin/mono-sgen" sig=11
mono[7661]: segfault at 5 ip 0000000000512710 sp 00007ffed5a32ee0 error 6 in mono-sgen[400000+34d000]
Not saving repeating crash in '/usr/bin/mono-sgen'
There is a lot more information in these messages, but I am still having a problem finding the cause. The last 5 lines are repeated three times.
I have tried making modifications to the apache config file (httpd.conf) as well as to the mod_mono.conf file, but nothing seems to get me past the problem.
In my current configuration the mod_mono.conf file is unmodified from the default configuration, and the only change that I have made to httpd.conf is to add a virtual host section as follows:
<VirtualHost *:80>
ServerName LDC-Demo
ServerAdmin root#localhost
ServerAlias LDC-Demo
DocumentRoot /var/www/html/LDC-Demo/
MonoServerPath LDC-Demo "/usr/bin/mod-mono-server4"
MonoDebug LDC-Demo true
MonoSetEnv LDC-Demo MONO_IOMAP=all
MonoApplications LDC-Demo "/:/var/www/html/LDC-Demo"
<Location "/LDC-Demo">
Allow from all
Order allow,deny
MonoSetServerAlias LDC-Demo
SetHandler mono
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
</Location>
</VirtualHost>
Any ideas would be appreciated, as I stated above, I have been working on this all week, and am not making much progress.
I entered this above as a comment, but I intended to answer the question.
I figuered it out. Fedora runs SELinux, and it was interfering with the permissions needed for mod_mono to run. To see these settings I ran the command: getenforce Then to temporarily change the setting I used the following command: setenforce 0 Finally, restart Apache: apachectl restart I refreshed the web browser and the page loaded correctly. To make the setting permanant, edit the selinux file: nano /etc/sysconfig/selinux I rebooted the server, and tried to load the webpage again. Eureka! everything is working.

HHVM With FCGI and APACHE show 500 Internal Server Error

Hy,
I have succesfully installed hhvm on my ubuntu 14.04 server. I can run codes from terminal with the following code.
hhvm test.php
The problem is when I want to access my webpage from browser I get 500 Internal Server Error. In the error log I have found the following lines.
[Fri Apr 24 14:26:37.377998 2015] [fcgid:warn] [pid 40696] (104)Connection reset by peer: [client 192.168.65.221:50382] mod_fcgid: error reading data from FastCGI server
[Fri Apr 24 14:26:37.378029 2015] [core:error] [pid 40696] [client 192.168.65.221:50382] End of script output before headers: index.php
I am using Apache web server with ISPConfig 3 to handle domains and other stuff.
Does anyone know how to handle this situation?
Thanks in advance, David.