Apache ist ein quelloffener Webserver. Auf einen Umstieg auf NginX wird geraten. Siehe auch htaccess, PHP und MySQL.
// apache apt-get install apache2 // php und apache mod for php apt-get install php7.0 libapache2-mod-php // mysql server apt-get install mysql-server // secure install mysql_secure_installation
change file mime type: https://stackoverflow.com/questions/3100956/enable-php-to-read-css-and-js-files-while-keeping-their-original-content-type
mod log files: https://httpd.apache.org/docs/current/mod/mod_log_config.html
Options +FollowSymLinks RewriteEngine On RewriteRule ^user/([0-9]*)/([a-z]*)$ ./index.php?user=$1&action=$2
https://stackoverflow.com/questions/10236717/how-to-prevent-a-file-from-direct-url-access
RewriteEngine on Options -Indexes // disable directory listing RewriteCond %{HTTP_REFERER} !^http://(www\.)? [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?.*$ [NC] RewriteRule \.(gif|jpg|jpeg|png)$ - [F]
In der vHost Konfig oder der globalen Apache Konfig (für localhost) Todo
Siehe Certbot
In den Ordnern /etc/apache2/sites-available/
und /etc/apache2/sites-enabled
liegen die Konfigurationen.
Mit a2ensite
kann man eine bestimmte Seite aktivieren bzw. mit a2dissite
deaktivieren. Man kann auch einfach einen Softlink setzen/löschen.
<VirtualHost *:80> ServerAdmin admin@localhost DocumentRoot /var/www/html ServerAlias localhost # Redirect permanent / https://localhost/ <Directory /var/www/html/> Options +FollowSymlinks AllowOverride All </Directory> ErrorLog /var/log/apache2/default-error_log CustomLog /var/log/apache2/default-access_log common </VirtualHost> <VirtualHost *:443> ServerAdmin admin@localhost DocumentRoot /var/www/html ServerAlias localhost <Directory /var/www/html/> Options +FollowSymlinks AllowOverride All </Directory> SSLEngine on SSLCertificateFile /etc/ssl/localhost.crt SSLCertificateKeyFile /etc/ssl/private/localhost.key SSLCertificateChainFile /etc/ssl/ca_bundle.crt ErrorLog /var/log/apache2/default-ssl-error_log CustomLog /var/log/apache2/default-ssl-access_log common </VirtualHost>
In apache/conf/httpd.conf add at the end
AddHandler cgi-script .jail ScriptInterpreterSource Registry-Strict
and in the files add the path to the interpreter and always output content-type at first!
#!C:/jail.exe print("Content-Type: text/html\n\n");