Difference between revisions of "User:Andr3w"

Jump to navigation Jump to search
Line 37: Line 37:
  sudo apt-get install python-certbot-nginx certbot
  sudo apt-get install python-certbot-nginx certbot
== /etc/nginx/sites-enabled/sqlzoo==
  server {
  server {
         root /var/www/html/sqlzoo;
         root /var/www/html/sqlzoo;

Revision as of 09:41, 16 January 2020

Pages that control everything

Language Test Page

My Pages

Setting up a server - nginx

sudo apt-get build-essentialsudo apt-get install nginx
sudo apt-get install mysql.server
#Set root password for mysql
sudo mysql_secure_installation
sudo apt-get install php-fpm php-mysql
sudo apt-get install php-fpm php-mysql
#Uncomment the fastcgi-pass bis for php in /etc/nginx/sites-enabled/default
sudo mkdir /var/www/html/sqlzoo
sudo chown andrew.andrew /var/www/html/sqlzoo
wget https://releases.wikimedia.org/mediawiki/1.34/mediawiki-1.34.0.tar.gz
tar xvf mediawiki-1.34.0.tar.gz
mv mediawiki-1.34.0 /var/www/html/sqlzoo/w
#On the existing site create mysql backup - media wiki and user attempts
# mysqldump sqlzoo_wiki -u root -p > sqlzoo_wiki.sql
scp -C sqlzoo.net:sqlzoo-mediawiki/sqlzoo_wiki.sql .
mysql -u root -p < sqlzoo_wiki.sql
#Do the same for attempts
#Create mysql user wikiuser
cd /var/www/html/sqlzoo/
rsync  -av -e ssh --exclude w sqlzoo.net:/var/www/html/sqlzoo/ .
cd w
rsync -v -e ssh --exclude w sqlzoo.net:/var/www/html/sqlzoo/w/LocalSettings.php  .
rsync -av -e ssh --exclude w sqlzoo.net:/var/www/html/sqlzoo/w/images  images
#Set up dns so that igs.sqlzoo.net points to the new server
sudo apt-get install python-certbot-nginx certbot


server {
       root /var/www/html/sqlzoo;
       index index.html index.htm index.nginx-debian.html index.php;
       server_name sqlzoo.net;
       default_type text/html;
       location ~ \.pl|cgi$ {
           try_files $uri =404;
           gzip off;
           fastcgi_index index.pl;
           fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
           include fastcgi_params;
       location ~* .\.php$ {
               fastcgi_pass unix:/run/php/php7.3-fpm.sock;
               include         fastcgi_params;
               fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
               fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
       location /wiki/ {
               rewrite ^/wiki/(?<pagename>.*)$ /w/index.php;
               include /etc/nginx/fastcgi_params;
               # article path should always be passed to index.php
               fastcgi_param SCRIPT_FILENAME $document_root/w/index.php;
               fastcgi_param PATH_INFO $pagename;
               fastcgi_param QUERY_STRING $query_string;
               fastcgi_pass unix:/run/php/php7.3-fpm.sock;
       location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg)$ {
               expires 365d;
       location /w/images {
               # Separate location for images/ so .php execution won't apply
       location ~ /\.ht {
               deny all;
       location = / {
               rewrite ^/$ /wiki/Main_Page;

Notes on squid


acl web_ports port 80
acl manager proto cache_object
http_access allow web_ports
http_access allow manager localhost
http_access deny manager
acl purge method PURGE
http_access allow purge localhost
http_access deny purge
http_access deny all
http_port accel defaultsite=sqlzoo.net vhost
cache_peer parent 80 0 originserver no-digest
#cache_peer parent 80 0 originserver no-digest
cache_dir ufs /var/log/squid/cache 10000 16 256

Changes to /etc/httpd/conf/httpd.conf

LogFormat "%{X-Forwarded-for}i %l %T %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T/%D" squided
CustomLog "logs/access_log" squided
SetEnv force-no-vary