Apache/XAMPP does not give access to subdirectory - apache

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.

Related

Enable HTTP2 in Apache 2.4.53

After reading this link, it's clear that HTTP2 and prefork don't work together. I am trying to get around this issue by disabling prefork in MPM.
I went and changed the httpd-mpm.conf and commented out the following statements:
<IfModule mpm_prefork_module>
#StartServers 5
#MinSpareServers 5
#MaxSpareServers 10
#MaxRequestWorkers 250
#MaxConnectionsPerChild 0
</IfModule>
and in my httpd.conf file i have enabled the module
LoadModule http2_module modules/mod_http2.so
and added the following configuration:
Protocols h2 h2c http/1.1
H2Direct on
I see no errors in my error log which are as follows:
[Thu Apr 14 23:03:59.295852 2022] [ssl:warn] [pid 18592:tid 220] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Apr 14 23:03:59.297852 2022] [mpm_winnt:notice] [pid 18592:tid 220] AH00455: Apache/2.4.53 (Win64) OpenSSL/1.1.1n configured -- resuming normal operations
[Thu Apr 14 23:03:59.297852 2022] [mpm_winnt:notice] [pid 18592:tid 220] AH00456: Apache Lounge VS16 Server built: Mar 16 2022 11:26:15
[Thu Apr 14 23:03:59.298852 2022] [core:notice] [pid 18592:tid 220] AH00094: Command line: 'httpd.exe -d C:/Users/naraadia/.softwares/Apache24_2.4.53'
[Thu Apr 14 23:03:59.320854 2022] [mpm_winnt:notice] [pid 18592:tid 220] AH00418: Parent: Created child process 14840
[Thu Apr 14 23:04:00.406963 2022] [ssl:warn] [pid 14840:tid 228] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Apr 14 23:04:00.449967 2022] [mpm_winnt:notice] [pid 14840:tid 228] AH00354: Child: Starting 64 worker threads.
and none of my pages being served by the server have HTTP2 or h2 protocol in developer tools. All the pages have http/1.1 protocol. Is there a better way to achieve HTTP2 protocol being pushed? I feel prefork is still not disabled.
I have downloaded the server zip file and not compiled the server.
EDIT 1 : After Reading the mod_http2 documentation, it's clear that winnt mpm strategy is being used.
I tried to check if curl helps in determining if HTTP2 is enabled or not but when I run
curl -I --http2 http://localhost:8083 | findstr HTTP
It returns nothing.
Can anyone help in enabling HTTP2 or help in determining what is missing?
I went and changed the httpd-mpm.conf and commented out the following statements:
Those statments were wrapped in an <IfModule mpm_prefork_module> so would only be used if that module was enabled.
EDIT 1 : After Reading the mod_http2 documentation, it's clear that winnt mpm strategy is being used.
That's correct. Apache on windows uses it's own mpm module, which is compatible with HTTP/2.
and none of my pages being served by the server have HTTP2 or h2 protocol in developer tools. All the pages have http/1.1 protocol. Is there a better way to achieve HTTP2 protocol being pushed? I feel prefork is still not disabled.
Browsers only support HTTP/2 over HTTPS. Looks like, from your curl command, that you are only using unencrypted HTTP, rather than HTTPS. So this will not work, even though you have enabled H2Direct - both client and server need to support this to work and you have only enabled it on the server and cannot enable this on the browser.
I tried to check if curl helps in determining if HTTP2 is enabled or not but when I run
curl -I --http2 http://localhost:8083 | findstr HTTP
It returns nothing.
Using HTTP/2 over HTTP (rather than HTTPS) requires an upgrade header and round trip, though that is going to be deprecated. You should use --http2-prior-knowledge if wanting to use HTTP/2 over HTTP and are sure the server supports it.

Apache2: No Effect Of ErrorLogFormat

i changed ErrorLogFormat at /etc/apache2/apache2.conf, but the this doesn't effect the log. I also added my ErrorLogFormat to the config files in the sites-enabled directory, but no effect.
ErrorLogFormat "[%{%Y-%m-%d %H:%M:%S}t] [%l] [client %a] %M"
This is the log:
[Sat Oct 13 13:01:56 2018] [error] [client 123.123.123.123:41204] AH01790: user `asd' in realm `some realm' not found: /
EDIT: It's running on a rasperry pi updated. I tested: stop and start, restart on the apache service and system reboot.
grep -r "ErrorLogFormat" /etc/apache2
revealed only the desired format, that i added at apache.conf and the conf files at sites-enabled.
In Apache 2.4 (https://httpd.apache.org/docs/2.4/mod/core.html#errorlogformat), you can use:
ErrorLogFormat "[%{cu}t] [%l] [client %a] %M"
%{cu}t: The current time in compact ISO 8601 format, including micro-seconds
In the log file it will show:
[2018-10-14 10:31:05.273482] [debug] [client AH00931: initialized single connection worker in child 4296 for (localhost)
The date format is the same as what you want, without having to specify all the rules you have.
If you use %{u}t, the log format becomes:
[Sun Oct 14 10:30:31.944078 2018] [info] [client ::1:47376] AH00128: File does not exist: /home/mbert/tools/apache/htdocs/so/oij
which is what you had previously.

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.

Localhost is not working

I spend a day this issue, and I can't fix it.
Everytime I try to access to my localhost or by typing 127.0.0.1, the browser that I'm using is returning an error like : "Firefox can not find the server address at www.localhost.com."(i'm french, I translated the issue).
The same issue occures in Google Chrome and with 127.0.0.1. I tried with XAMPP and WAMP, still nothing. My Apache httpd.conf seems good, I tried to change the port (8080, 81, 8800). It still not working. My Skype is not open nether VMware Workstation. There is no program blocking the access to port 80 or 443.
I've made a ping test with the localhost and everthing is ok, but I can't access the index page of WAMP or XAMP.
The weird thing is that I can access to localhost/phpmyadmin and other pages like that.
I think my problem is in the hosts file of Windows, but it seems ok to me :
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 localhost
::1 localhost
Why am I thinking of the hosts file? Because my vhost in XAMPP and in WAMP are not working. Maybe I'm wrong, but this problem is driving me crazy!
Thanks for the help
If you have defined Virtual Hosts, and thats a very good idea, then you need to define the vhosts name in the HOSTS file.
For example, the hosts file:
127.0.0.1 localhost
::1 localhost
127.0.0.1 vhost1.dev
::1 vhost1.dev
127.0.0.1 vhost2.dev
::1 vhost2.dev
Otherwise windows has no way of knowing where to look for them.
Another possibility for localhost not working is a corrupted HOSTS file. Try deleting it and recreating it with an editor that is not notepad.
Also when you change the HOSTS file you need to restart the dmscache service 'DNS Client' by either rebooting or better still run a command window using "Run as Administrator" and do this
net stop dnscache
net start dnscache
that activates the new entries in your hosts file.
The weird thing is that I can access to localhost/phpmyadmin and other
pages like that.
Sounds to me like your hosts file is fine. There is something preventing Apache from starting up and binding to your port.
I'm not too familiar with Windows, but from the documentation:
Any errors during Apache startup are logged into the Windows event log
when running on Windows NT. This mechanism acts as a backup for those
situations where Apache is not yet prepared to use the error.log file.
You can review the Windows Application Event Log by using the Event
Viewer, e.g. Start - Settings - Control Panel - Administrative Tools -
Event Viewer.
Take a look to see what is preventing Apache from booting.
I don't now if it will help you, this is what I get in my log when I restart Apache
[Thu Jun 05 15:41:13.480163 2014] [mpm_winnt:notice] [pid 9984:tid 392] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Thu Jun 05 15:41:15.481278 2014] [mpm_winnt:notice] [pid 6728:tid 268] AH00364: Child: All worker threads have exited.
[Thu Jun 05 15:41:15.504279 2014] [mpm_winnt:notice] [pid 9984:tid 392] AH00430: Parent: Child process 6728 exited successfully.
[Thu Jun 05 15:41:20.536567 2014] [ssl:warn] [pid 9648:tid 392] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jun 05 15:41:20.735578 2014] [ssl:warn] [pid 9648:tid 392] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jun 05 15:41:20.757580 2014] [mpm_winnt:notice] [pid 9648:tid 392] AH00455: Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.11 configured -- resuming normal operations
[Thu Jun 05 15:41:20.757580 2014] [mpm_winnt:notice] [pid 9648:tid 392] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13
[Thu Jun 05 15:41:20.757580 2014] [core:notice] [pid 9648:tid 392] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Thu Jun 05 15:41:20.758580 2014] [mpm_winnt:notice] [pid 9648:tid 392] AH00418: Parent: Created child process 3700
[Thu Jun 05 15:41:21.108600 2014] [ssl:warn] [pid 3700:tid 268] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jun 05 15:41:21.274609 2014] [ssl:warn] [pid 3700:tid 268] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jun 05 15:41:21.296610 2014] [mpm_winnt:notice] [pid 3700:tid 268] AH00354: Child: Starting 150 worker threads.
Yesterday, I managed to get rid of the [ssl:warn] [pid 3700:tid 268] AH01909, but that wasn't the problem.
In my windows event viewer, there is no change, nothing was reported at same time of the restart.
Note : I've uninstall my current antivirus (I now it's not recommanded) and my Windows firewall does't seesm to block the connection to localhost.
Ok I've done what RiggsFolly told me. I delete my hosts file and create a new one. I restart my dmscache service. After, that I decide to create a virtual host for my localhost. In my httpd.conf, I checked if the Virtual hosts were inlucde
Include conf/extra/httpd-vhosts.conf
and in my httpd-vhosts.conf I wrote :
<Directory "/xampp/htdocs">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster#das.com
DocumentRoot /xampp/htdocs/
<Directory "/xampp/htdocs/">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Now everything seems to work, I can create other virtual hosts with custom name in my hosts file.

localhost/phpmyadmin 404 error

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