0

I am trying to configure stats on Apache 2.4 and I'm unable to make it works. This is my current configuration:

$ cat sites-enabled/000-default.conf

<VirtualHost *:80>
        Redirect 404 /
        ErrorDocument 404 "Page Not Found"
</VirtualHost>

<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias test.example.com dev.example.com 127.0.0.1 web.example.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/modx
    Header set Content-Security-Policy: "frame-ancestors 'self' http://resources.example.com https://resources.example.com http://web.example.com https://web.example.com"
    Header set X-Frame-Options "allow-from https://resources.example.com https://web.example.com"
    Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SetEnvIf Origin "http(s)?://(www\.)?(devaccess.example.com|testaccess.example.com)$" AccessControlAllowOrigin=$0
    Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin

    <Location /server-status>
        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
    </Location>
</VirtualHost>

Someone can help me, please. What I am doing wrong?

When I curl it, I'm getting this:

$ curl -v http://127.0.0.1/server-status?auto
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> GET /server-status?auto HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 127.0.0.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Mon, 13 May 2019 21:08:14 GMT
* Server Apache is not blacklisted
< Server: Apache
< Strict-Transport-Security: max-age=63072000; includeSubDomains
< Location: https://127.0.0.1/server-status?auto
< Content-Length: 244
< Content-Type: text/html; charset=iso-8859-1
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://127.0.0.1/server-status?auto">here</a>.</p>
</body></html>
* Connection #0 to host 127.0.0.1 left intact
  • As can you see in the output of curl, you had been redirected to https. Check configurations of other sites. Also, it can be the rewrite rules or something other in the .htaccess file. – Anton Danilov May 13 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.