summaryrefslogtreecommitdiff
path: root/tech/set up mysql php.txt
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-08-13 16:26:13 -0400
committerluxagraf <sng@luxagraf.net>2020-08-13 16:26:13 -0400
commitc657feb58769c1f975af2f2ab4968da1b1e42158 (patch)
treea1bf11fbaedb094c480ebbdc9e4e0d83508b1090 /tech/set up mysql php.txt
parent0d1cba91e435b1d613735d4537a64673e5c2731d (diff)
added reading moved tech to folder cleaned up old notes
Diffstat (limited to 'tech/set up mysql php.txt')
-rw-r--r--tech/set up mysql php.txt144
1 files changed, 144 insertions, 0 deletions
diff --git a/tech/set up mysql php.txt b/tech/set up mysql php.txt
new file mode 100644
index 0000000..2856f05
--- /dev/null
+++ b/tech/set up mysql php.txt
@@ -0,0 +1,144 @@
+
+
+Everything you need for wordpress and piwik:
+
+apt-get install php5-dev libssh2-1-dev libssh2-php php5-geoip libgeoip-dev mysql-server php5-mysql php5-fpm fcgiwrap
+
+then run:
+
+sudo mysql_install_db
+sudo /usr/bin/mysql_secure_installation
+
+
+mysql -u root -p
+CREATE DATABASE local_stats_piwik;
+CREATE USER piwiklocalstats@localhost;
+SET PASSWORD FOR piwiklocalstats@localhost= PASSWORD("");
+GRANT ALL PRIVILEGES ON local_stats_piwik. TO piwiklocalstats IDENTIFIED BY '';
+
+CREATE DATABASE longhandpixels_lhp_wp;
+CREATE USER longhandpixels@localhost;
+SET PASSWORD FOR longhandpixels@localhost= PASSWORD("");
+GRANT ALL PRIVILEGES ON longhandpixels_lhp_wp. TO longhandpixels IDENTIFIED BY '';
+
+FLUSH PRIVILEGES;
+
+next edit
+
+sudo vim /etc/php5/fpm/php.ini
+
+cgi.fix_pathinfo=0
+
+open_basedir = '/home/wp-user:/tmp:/home/lxf/git:/var/www/stats.luxagraf.net:/var/www/rss.luxagraf.net:/var/www/rss.longhandpixels.net:/var/www/longhandpixels.net:/var/www/git.luxagraf.net:/var/www/storage.luxagraf.net:/var/www/dev.longhandpixels.net'
+
+then:
+
+sudo service php5-fpm restart
+
+last thing to do for wordpress is create a user for secure updates. reference: https://www.digitalocean.com/community/tutorials/how-to-configure-secure-updates-and-installations-in-wordpress-on-ubuntu
+
+sudo adduser wp-user
+sudo chown -R wp-user:wp-user ~/apps/longhandpixels.net
+sudo su - wp-user
+ssh-keygen -t rsa -b 4096 # save in /home/wp-user/wp_rsa
+(answer blank to everything, including password)
+exit
+sudo chown wp-user:www-data /home/wp-user/wp_rsa*
+sudo chmod 0640 /home/wp-user/wp_rsa*
+sudo mkdir /home/wp-user/.ssh
+sudo chown wp-user:wp-user /home/wp-user/.ssh/
+sudo chmod 0700 /home/wp-user/.ssh/
+sudo cp /home/wp-user/wp_rsa.pub /home/wp-user/.ssh/authorized_keys
+sudo chown wp-user:wp-user /home/wp-user/.ssh/authorized_keys
+sudo chmod 0644 /home/wp-user/.ssh/authorized_keys
+sudo vim /home/wp-user/.ssh/authorized_keys
+
+add this to restrict to local connections:
+from="127.0.0.1" ssh-rsa...
+then
+
+sudo apt-get update
+sudo apt-get install php5-dev libssh2-1-dev libssh2-php
+vim apps/longhandpixels.net/wp-config.php
+
+add these lines:
+
+define('FTP_PUBKEY','/home/wp-user/wp_rsa.pub');
+define('FTP_PRIKEY','/home/wp-user/wp_rsa');
+define('FTP_USER','wp-user');
+define('FTP_PASS','');
+define('FTP_HOST','127.0.0.1:sshport');
+
+restart nginx and it should work. make sure that wp-user in allowed ssh hosts and /home/wp-user/ is in open_basedir in php.ini.
+
+
+## Piwik specific:
+
+grab piwik:
+
+wget http://builds.piwik.org/piwik.zip && unzip piwik.zip
+mv piwik apps/app.name
+sudo chown -R www-data:www-data apps/app.name
+mkdir -p /tmp/cache/tracker/
+
+
+apt-get install php5-gd libfreetype6 # for nice parklines
+
+How do I install the GeoIP Geo location PECL extension? from http://piwik.org/faq/how-to/#faq_163
+
+ sudo pecl install geoip
+
+Finally, add the following to your php.ini file:
+
+ extension=geoip.so
+ geoip.custom_directory=/path/to/piwik/misc
+
+Replace /path/to/piwik with the path to your Piwik installation.
+
+And finally, if you are using the GeoLite City database there is one more thing you need to do. The PECL extension won’t recognize the database if it’s named GeoLiteCity.dat so make sure it is named GeoIPCity.dat.
+
+in my case :
+
+ cp GeoLiteCity.dat apps/stats.luxagraf.net/misc/GeoIPCity.dat
+
+sudo chown -R www-data:www-data apps/stats.luxagraf.net/misc/GeoIPCity.dat
+
+# postgres, postgis python setup
+
+apt-get install build-essential python python3 python-dev python3-dev python-pip python3-pip python-setuptools
+sudo apt-get install postgresql postgresql-server-dev-all
+sudo apt-get install binutils libproj-dev gdal-bin postgis postgresql-9.4-postgis-2.1
+
+
+Stuff for Pillow:
+apt-get install libtiff5-dev libjpeg62-turbo-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
+
+Install uwsgi:
+
+PIP_REQUIRE_VIRTUALENV=false
+sudo pip3 install uwsgi
+
+sudo vi /etc/systemd/system/uwsgi.service
+
+
+[Unit]
+Description=uWSGI Emperor
+After=syslog.target
+
+[Service]
+ExecStart=/usr/local/bin/uwsgi --ini /etc/uwsgi/emperor.ini
+Restart=always
+KillSignal=SIGQUIT
+Type=notify
+StandardError=syslog
+NotifyAccess=all
+
+[Install]
+WantedBy=multi-user.target
+
+
+sudo mkdir -p /etc/uwsgi/vassals/ && cd /etc/uwsgi/vassals
+sudo ln -s ~/apps/luxagraf/config/django.ini /etc/uwsgi/vassals/
+sudo systemctl start uwsgi
+sudo systemctl enable uwsgi
+