Linux - Applications: Difference between revisions

From Smithnet Wiki
Jump to navigation Jump to search
m (1 revision imported)
Line 42: Line 42:


Set SELinux:
Set SELinux:
  setbool -P httpd_read_user_content 1
  setsebool -P httpd_read_user_content 1
  setbool -P httpd_can_network_connect 1
  setsebool -P httpd_can_network_connect 1
  setbool -P httpd_can_network_connect_db 1
  setsebool -P httpd_can_network_connect_db 1


* Unpack [https://www.mediawiki.org/wiki/Extension:Math Math] under /usr/share/mediawiki/extensions/Math
* Unpack [https://www.mediawiki.org/wiki/Extension:Math Math] under /usr/share/mediawiki/extensions/Math

Revision as of 07:59, 18 February 2023

Apache

  • /etc/httpd/conf/httpd.conf
  • /etc/httpd/conf.d/ssl.conf
  • /etc/httpd/conf.d/proxy_ajp.conf to connect to Tomcat over AJP

PHP packages:

 php php-mbstring php-pear php-fpm
  • User directories
setsebool -P httpd_enable_homedirs 1
chmod 711 /home/someuser
chmod 755 /home/someuser/public_html

After updating certificate (and key) SELinux may not allow access. Fix with:

restorecon -v /etc/pki/tls/certs/www.smithnet.org.uk.cert.pem

HTTP/2

Enable in httpd.conf (globally or in a virtual host):

Protocols h2 h2c http/1.1

Use curl to check protocol switching:

curl --http2 -v localhost
...
< HTTP/1.1 101 Switching Protocols
< Upgrade: h2c
< Connection: Upgrade
* Received 101
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 200
...

Mediawiki

  • Install PHP, including php-pgsql driver and php-pecl-apcu object caching.
  • Uncomment in /etc/httpd/conf.d/mediawiki.conf

Set SELinux:

setsebool -P httpd_read_user_content 1
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1
  • Unpack Math under /usr/share/mediawiki/extensions/Math
  • Run setup http://hostname/wiki
    • Allow it to create DB user/schema
    • Tick Math option
  • Configuration: /usr/share/mediawiki/LocalSettings.php

Customisations:

$wgServer           = "http://www.smithnet.org.uk";
$wgEmergencyContact = "[email protected]";
$wgPasswordSender   = "[email protected]";
$wgLogo             = "/images/smithnet_wiki.png";

Add new file types for upload, and enable uploads:

$wgFileExtensions[] = 'pdf';
$wgEnableUploads = true;

Extra Logging:

$wgShowExceptionDetails = true;

Export/Import

Export all content as XML:

php /usr/share/mediawiki/maintenance/dumpBackup.php --full > dump.xml

After RPM upgrade, may need to update database schema:

/usr/share/mediawiki/maintenance/update.php

Extensions

  • /usr/share/mediawiki/extensions
  • Update database after configuration changes:
php maintenance/update.php --conf ./LocalSettings.php

eg creates mathoid table for Math extension

Math extension should used Mathoid (Wikimedia's REST API); in LocalSettings.php:

$wfLoadExtension( 'Math' );
$wgDefaultUserOptions['math'] = 'mathml';
$wgMathFullRestbaseURL = 'https://en.wikipedia.org/api/rest_';

Tomcat

  • /etc/tomcat/conf/server.xml (define required connectors)
  • /etc/tomcat/conf/tomcat-users.xml
  • Webapps deplyed to: /var/lib/tomcat/webapps
    • tomcat-webapps
    • tomcat-docs-webapps
    • tomcat-admin-webapps