For mediawiki to work on apache2 a file /etc/apache2/conf/mediawiki is required. Where can I find it?
Asked
Active
Viewed 4,918 times
2
Videonauth
- 33,045
- 16
- 104
- 120
Tommy Pollák
- 1,019
- 2
- 9
- 16
-
2Welcome to AskUbuntu! Best is you [edit](http://askubuntu.com/posts/788658/edit) your question and add the link of which tutorial you're actually trying to follow and as well what steps you already did, so your question becomes more clear and easier to understand. Beside that there is no directory called `conf` in `/etc/apache2`. – Videonauth Jun 18 '16 at 19:28
1 Answers
1
Good idea is to make a dedicated Virtual Host (who will run separate subdomain) for each MediaWiki on your server. Apache2 virtualhost.conf files are contained in the folder /etc/apache2/sites-available/.
For example, the VH configuration file could be named as follow (note its name must end with .conf): /etc/apache2/sites-available/wiki.example.com.conf. And its sample content should be something like:
<VirtualHost *:80>
ServerName wiki.example.com
ServerAdmin admin@wiki.example.com
# Redirect Requests to SSL
Redirect permanent "/" "https://wiki.example.com/"
ErrorLog ${APACHE_LOG_DIR}/wiki.example.com.error.log
CustomLog ${APACHE_LOG_DIR}/wiki.example.com.access.log combined
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerName wiki.example.com
ServerAdmin admin@wiki.example.com
DocumentRoot /var/www/wiki.example.com
# According MWiki Manual:Security
php_flag register_globals off
ErrorLog ${APACHE_LOG_DIR}/wiki.example.com.error.log
CustomLog ${APACHE_LOG_DIR}/wiki.example.com.access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/wiki.example.com.crt
SSLCertificateKeyFile /etc/ssl/private/wiki.example.com.key
SSLCertificateChainFile /etc/ssl/certs/wiki.example.com.root-bundle.crt
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
<Directory /var/www/wiki.example.com>
Options None FollowSymLinks
#Allow .htaccess
AllowOverride All
Require all granted
<IfModule security2_module>
SecRuleEngine Off
# or disable only problematic rules
</IfModule>
</Directory>
# According to MWiki Manual:Security
<Directory /var/www/wiki.example.com/images>
# Ignore .htaccess files
AllowOverride None
# Serve HTML as plaintext, don't execute SHTML
AddType text/plain .html .htm .shtml .php .phtml .php5
# Don't run arbitrary PHP code.
php_admin_flag engine off
# If you've other scripting languages, disable them too.
</Directory>
#According to MWiki Manual:Security
<Directory /var/www/wiki.example.com/images/deleted>
Deny from all
AllowOverride AuthConfig Limit
Require local
</Directory>
</VirtualHost>
</IfModule>
Note that, this example is for configuration with enabled HTTPS/SSL. For pure HTTP it must look like:
<VirtualHost *:80>
ServerName wiki.example.com
ServerAdmin admin@wiki.example.com
DocumentRoot /var/www/wiki.example.com
# According MWiki Manual:Security
php_flag register_globals off
ErrorLog ${APACHE_LOG_DIR}/wiki.example.com.error.log
CustomLog ${APACHE_LOG_DIR}/wiki.example.com.access.log combined
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
<Directory /var/www/wiki.example.com>
Options None FollowSymLinks
#Allow .htaccess
AllowOverride All
Require all granted
<IfModule security2_module>
SecRuleEngine Off
# or disable only problematic rules
</IfModule>
</Directory>
# According to MWiki Manual:Security
<Directory /var/www/wiki.example.com/images>
# Ignore .htaccess files
AllowOverride None
# Serve HTML as plaintext, don't execute SHTML
AddType text/plain .html .htm .shtml .php .phtml .php5
# Don't run arbitrary PHP code.
php_admin_flag engine off
# If you've other scripting languages, disable them too.
</Directory>
#According to MWiki Manual:Security
<Directory /var/www/wiki.example.com/images/deleted>
Deny from all
AllowOverride AuthConfig Limit
Require local
</Directory>
</VirtualHost>
To activate the VirtyalHost you need to run:
sudo a2ensite wiki.example.com.conf
sudo systemctl restart apache2.service
Read also:
pa4080
- 29,351
- 10
- 85
- 161