Visitors To This Post

Search This Blog

Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Sunday, January 1, 2023

Apache2 Ubuntu Default Page: It works Apache2 Ubuntu Default Page

 

Apache2 Ubuntu Default Page: It works Apache2 Ubuntu Default Page
It works!

This is the default welcome page used to test the correct operation of the Apache2 server after installation on Debian systems. If you can read this page, it means that the Apache HTTP server installed at this site is working properly. You should replace this file (located at /var/www/html/index.html) before continuing to operate your HTTP server.

If you are a normal user of this web site and don't know what this page is about, this probably means that the site is currently unavailable due to maintenance. If the problem persists, please contact the site's administrator.

Configuration Overview

Debian's Apache2 default configuration is different from the upstream default configuration, and split into several files optimized for interaction with Debian tools. The configuration system is fully documented in /usr/share/doc/apache2/README.Debian.gz. Refer to this for the full documentation. Documentation for the web server itself can be found by accessing the manual if the apache2-doc package was installed on this server.

The configuration layout for an Apache2 web server installation on Debian systems is as follows:

/etc/apache2/
|-- apache2.conf
|       `--  ports.conf
|-- mods-enabled
|       |-- *.load
|       `-- *.conf
|-- conf-enabled
|       `-- *.conf
|-- sites-enabled
|       `-- *.conf
          
  • apache2.conf is the main configuration file. It puts the pieces together by including all remaining configuration files when starting up the web server.
  • ports.conf is always included from the main configuration file. It is used to determine the listening ports for incoming connections, and this file can be customized anytime.
  • Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/ directories contain particular configuration snippets which manage modules, global configuration fragments, or virtual host configurations, respectively.
  • They are activated by symlinking available configuration files from their respective *-available/ counterparts. These should be managed by using our helpers a2enmod, a2dismod, a2ensite, a2dissite, and a2enconf, a2disconf . See their respective man pages for detailed information.
  • The binary is called apache2. Due to the use of environment variables, in the default configuration, apache2 needs to be started/stopped with /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not work with the default configuration.
Document Roots

By default, Debian does not allow access through the web browser to any file apart of those located in /var/www, public_html directories (when enabled) and /usr/share (for web applications). If your site is using a web document root located elsewhere (such as in /srv) you may need to whitelist your document root directory in /etc/apache2/apache2.conf.

The default Debian document root is /var/www/html. You can make your own virtual hosts under /var/www. This is different to previous releases which provides better security out of the box.

Reporting Problems

Please use the reportbug tool to report bugs in the Apache2 package with Debian. However, check existing bug reports before reporting a new bug.

Please report bugs specific to modules (such as PHP and others) to respective packages, not to the web server itself.

Valid XHTML 1.0 Transitional

Sunday, February 23, 2020

W3C-Validator Ubunut-Fix

Source:
https://askubuntu.com/questions/471523/install-wc3-markup-validator-locally






How to install and use w3c markup validator on Ubuntu 13.10 locally? I know I can install it by installing following packages:
sudo apt-get install libapache2-mod-perl2   
sudo apt-get install w3c-markup-validator

but how do I configure it to use it same way as on-line version (that is by web browser), but locally?

Its uses CGI to work, and is probably designed for a webserver - the script on ubuntu seems to be located at /usr/lib/cgi-bin/w3c-markup-validator/check. Also: stackoverflow.com/a/16673201/2943276Wilf May 24 '14 at 14:42

If you find a way to use the validator offline, can you reply with detailed steps please, I was also looking for that :) – MrVaykadji May 24 '14 at 14:59

 2 Answers:

Good news! So if you have apache2 already installed, you install W3C Validator and Perl:
sudo apt-get install w3c-markup-validator libapache2-mod-perl2

The issue is that the w3c-markup-validator package hasn't been updated to install properly on 13.10+ (I'm on 14.04). To fix it manually:
sudo ln -s /etc/w3c/httpd.conf /etc/apache2/conf-enabled/w3c-markup-validator.conf

I then had an issue where /usr/lib/cgi-bin didn't have the correct permissions.

This is due to a problem in /etc/apache2/conf-available/serve-cgi-bin.conf where it will only give the correct permission if the module is being loaded. It appears this version of perl isn't listed in the IfModule statement. To fix this:
sudo gedit /etc/apache2/conf-available/serve-cgi-bin.conf

You want it to look like this:
 ---------------------------------------------------------------------
<IfModule mod_alias.c>
    <IfModule mod_cgi.c>
        Define ENABLE_USR_LIB_CGI_BIN
    </IfModule>

    <IfModule mod_cgid.c>
        Define ENABLE_USR_LIB_CGI_BIN
    </IfModule>

    <IfModule mod_perl.c>
        Define ENABLE_USR_LIB_CGI_BIN
    </IfModule>

    <IfDefine ENABLE_USR_LIB_CGI_BIN>
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Require all granted
        </Directory>
    </IfDefine>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
---------------------------------------------------------------------

Once you're done with these steps you have to symlink validator's html directory to /var/www/html:
sudo ln -s /usr/share/w3c-markup-validator/html /var/www/html/w3c-validator 

Once the file is linked and the changes are in place, all you have to do is restart the Apache server:
sudo service apache2 restart

Check that it's all working
http://localhost/w3c-validator

CSS might be missing from validator page in the browser, but validation should work well.

Try sudo xdg-open http://localhost/w3c-validator or to change httpd.conf's permission with sudo chown $USER:$USER /etc/w3c/httpd.conf and sudo chmod 777 /etc/w3c/httpd.conf. – MrVaykadji May 25 '14 at 19:52


I gave that a try and it didn't work. I'm pretty sure the problem is in /etc/w3c/httpd.conf and how it uses mod_rewrite to link to /usr/lib/cgi-bin/w3c-markup-validator/check. Possibly an Apache rule about running code perl that's not in the docroot... – Skarard May 25 '14 at 20:15


/etc/w3c/validator.conf might also need checking. E.g. there might be a validator.conf.dpkg-dist that is different. – Wolfgang Fahl Apr 13 '16 at 5:29


After applying @Skarard's answer the W3CValidator showed up but the check didn't work. There were errors in /var/log/apache2/error.log
  AH01337: Could not parse expr "$QUERY_STRING = /(^|[;&])debug(=[^0]?)?(\\b|$)/" in /usr/share/w3c-markup-validator/html/header.html: Parse error near '$'
  AH01337: Could not parse expr "$includeJS = 1" in /usr/share/w3c-markup-validator/html/header.html: Parse error near '$'
  AH01337: Could not parse expr "$debug = 1" in /usr/share/w3c-markup-validator/html/header.html: Parse error near '$'
  AH01337: Could not parse expr "$feeds = 1" in /usr/share/w3c-markup-validator/html/header.html: Parse error near '$'

So I found out that the validator.conf file was pointing to a wrong schema location. There was a left over validator.conf.dpkg-dist
/etc/w3c# diff validator.conf validator.conf.dpkg-dist 
42c42
<     Library = /usr/share/xml/xhtml/schema/dtd
---
>     Library = /usr/share/xml/w3c-sgml-lib/schema/dtd
57c57
< Allow Private IPs = yes
---
> Allow Private IPs = no
75c75
<   Allow = http
---
>   Allow = data,ftp,http,https
118,123d117
< 
< #
< # Source for the "Tip of The Day" blurbs.
< <Tips>
<   Include tips.cfg
< </Tips>

I moved the validator.conf.dkpk-dist to validator.conf and restarted apache. The error messages in /var/log/apache2/error.log were still there.
Apache 2.4 being in use seemed to be the reason as outlined in https://stackoverflow.com/questions/14878076/how-does-expression-work-in-apache-2-4) so i had to add
SSILegacyExprParser On
to the w3c-markup-validator.conf file.