Difference between revisions of "Category:Web"

From ElectroDragon
Jump to navigation Jump to search
(Created page with "category: Topics")
 
Line 1: Line 1:
[[category: Topics]]
+
== Environment ==
 +
{| class="wikitable sortable"
 +
|-
 +
! Type !! PHP !! -
 +
|-
 +
| Debian 9/8 || 5.6 || -
 +
|-
 +
| Ubuntu 17/16 || 7 || -
 +
 
 +
|}
 +
 
 +
* Reference from here [https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-debian-8 LEMP]
 +
== Debug ==
 +
=== PHP ===
 +
* Debug  -> vim /etc/php5/fpm/pool.d/www.confMake necessary changes to match following values:
 +
slowlog = /var/log/php5/slow.log
 +
request_slowlog_timeout = 10s
 +
 
 +
=== MYSQL debug ===
 +
* enter into shell -> mysql -u root -p
 +
* Enable log -> set global slow_query_log = 'ON';
 +
* Set log address ->  set global slow_query_log_file ='/var/log/mysql/slow-query.log';
 +
 
 +
=== the rest debug ===
 +
* Use wordpress plugin Query Monitor
 +
* Use WP Debug
 +
<syntaxhighlight lang="c">
 +
/**
 +
* For developers: WordPress debugging mode.
 +
*
 +
* Change this to true to enable the display of notices during development.
 +
* It is strongly recommended that plugin and theme developers use WP_DEBUG
 +
* in their development environments.
 +
*/
 +
define('WP_DEBUG', true);
 +
define('SAVEQUERIES', true);
 +
 
 +
</syntaxhighlight>
 +
* [https://developers.google.com/speed/pagespeed/?hl=zh-CN&utm_source=PSI&utm_medium=incoming-link&utm_campaign=PSI Google speed page test]
 +
=== UFW ===
 +
* ufw app list
 +
=== Log ===
 +
* ngxtop
 +
 
 +
== Docker ==
 +
docker run -d -p 80:80 --name=mynginx -v $PWD/html:/usr/share/nginx/html nginx
 +
* -d daemon -p port, --name, -v volume
 +
* docker pull nginx
 +
* Basic
 +
docker container run \
 +
  -d \
 +
  -p 127.0.0.2:8080:80 \
 +
  --rm \
 +
  --name mynginx \
 +
  nginx
 +
* -d daemon, -p port, --rm remove after close --name name
 +
* stop it - docker container stop mynginx
 +
* mkdir Nginx_files cd and mkdir html
 +
* nano index.html write <nowiki><h1>Hello World</h1></nowiki>
 +
* V2
 +
docker container run \
 +
  -d \
 +
  -p 127.0.0.2:8080:80 \
 +
  --rm \
 +
  --name mynginx \
 +
  --volume "$PWD/html":/usr/share/nginx/html \
 +
  nginx
 +
* copy config file -> docker container cp mynginx:/etc/nginx .
 +
* copy folder nginx to current folder .
 +
* Other files
 +
log:/var/log/nginx/
 +
config:/etc/nginx/
 +
project:/usr/share/nginx/html
 +
* enter into docker -> docker exec -it nginx /bin/bash
 +
 
 +
== App ==
 +
* Gitlab
 +
* Seafile
 +
=== rsync ===
 +
==== Webfiles side ====
 +
{| class="wikitable sortable"
 +
|-
 +
! Header text !! Header text !! Header text
 +
|-
 +
| 1. create config file ||
 +
* nano /etc/rsyncd.conf
 +
||
 +
|-
 +
| 2. Config ||
 +
uid = nobody
 +
gid = nobody
 +
use chroot = no
 +
max connections = 10
 +
strict modes = yes
 +
pid file = /var/run/rsyncd.pid
 +
lock file = /var/run/rsync.lock
 +
log file = /var/log/rsyncd.log
 +
 
 +
[bk_files]
 +
path = /backup/idehe.com
 +
comment = backup idehe.com file
 +
ignore errors
 +
read only = no
 +
write only = no
 +
hosts allow = *
 +
hosts deny = 192.168.1.1
 +
list = false
 +
uid = root
 +
gid = root
 +
auth users = backup
 +
secrets file = /etc/server.pass
 +
||
 +
* backup user name backup
 +
* backup pass at /etc/server.pass
 +
* backup module [bk_files], inside folder is /backup/idehe.com
 +
|-
 +
| 3. create secrete files ||
 +
* nano pass
 +
* backup:password
 +
* chmod 666 pass
 +
* maybe restart rsync --daemon
 +
||
 +
* backup:password, user name and pass
 +
|}
 +
==== Backup side ====
 +
{| class="wikitable sortable"
 +
|-
 +
! Steps !! Header text !! Header text
 +
|-
 +
| 1. create secrete file ||
 +
* nano server.pass, and then type pass
 +
* chmod 600 server.pass
 +
||
 +
|-
 +
| 2. Main command ||
 +
* rsync -azvi --delete --progress  backup@104.131.88.5::bk_files /backup/idehe.com/ --password-file=/backup/idehe.com.pass
 +
* rsync -azvi --delete --progress  backup@168.235.94.174::bk_files /backup/szdxpy.cc/ --password-file=/backup/szdxpy.cc.pass
 +
|| Example
 +
|-
 +
| 3. Note config ||
 +
* -azvi
 +
* --delete delete file on this side
 +
* --progress show transfer progress
 +
* --exclude "*access*" --exclude "debug", exclude files
 +
* backup is rsync user name
 +
* 172.16.22.126 remote server
 +
* bk_files is backup module
 +
* /backup/idehe.com/ local folder
 +
* --password-file=/etc/server.pass, use pass
 +
|| Example
 +
|-
 +
| 4. setup cronteb -e ||
 +
* 00 01 * * * rsync -azvi --delete --progress  backup@104.131.88.5::bk_files /backup/idehe.com/ --password-file=/backup/server.pass
 +
|-
 +
 
 +
|}
 +
 
 +
=== Forum ===
 +
{| class="wikitable sortable"
 +
|-
 +
! Type !! alexa !! - !! prerequisite 
 +
|-
 +
| vanilla || 72K || [https://github.com/vanilla/vanilla github - 1.7K ] || PHP7
 +
|-
 +
| Carbon forum || 687K || [https://github.com/lincanbin/Carbon-Forum github - 1.25K] ||
 +
|-
 +
| phpbb || 42K || free
 +
|-
 +
| nodebb || 189K || [https://github.com/NodeBB/NodeBB github]
 +
|-
 +
| smf || 69K || free
 +
|-
 +
| mybb || 68K || free
 +
|-
 +
| woltlab || 115K || free
 +
|-
 +
| discourse || 35K  || [https://github.com/discourse/discourse github] || 2GB RAM min.
 +
|-
 +
| flarum || 119K || beta version now
 +
|-
 +
| fluxbb || 661K || non-free
 +
|-
 +
| IPS Board || 44K || non-free
 +
|-
 +
| xenforo || 39K || non-free
 +
|-
 +
| vbulletin || 67K || non-free
 +
|}
 +
=== Mysqltuner ===
 +
 
 +
== Reference tutorial ==
 +
* https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04
 +
 
 +
 
 +
[[category: Topics]] [[category: Linux]]

Revision as of 09:48, 1 December 2019

Environment

Type PHP -
Debian 9/8 5.6 -
Ubuntu 17/16 7 -
  • Reference from here LEMP

Debug

PHP

  • Debug -> vim /etc/php5/fpm/pool.d/www.confMake necessary changes to match following values:
slowlog = /var/log/php5/slow.log
request_slowlog_timeout = 10s

MYSQL debug

  • enter into shell -> mysql -u root -p
  • Enable log -> set global slow_query_log = 'ON';
  • Set log address -> set global slow_query_log_file ='/var/log/mysql/slow-query.log';

the rest debug

  • Use wordpress plugin Query Monitor
  • Use WP Debug
/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 */
define('WP_DEBUG', true);
define('SAVEQUERIES', true);

UFW

  • ufw app list

Log

  • ngxtop

Docker

docker run -d -p 80:80 --name=mynginx -v $PWD/html:/usr/share/nginx/html nginx

  • -d daemon -p port, --name, -v volume
  • docker pull nginx
  • Basic
docker container run \
 -d \
 -p 127.0.0.2:8080:80 \
 --rm \
 --name mynginx \
 nginx
  • -d daemon, -p port, --rm remove after close --name name
  • stop it - docker container stop mynginx
  • mkdir Nginx_files cd and mkdir html
  • nano index.html write <h1>Hello World</h1>
  • V2
docker container run \
 -d \
 -p 127.0.0.2:8080:80 \
 --rm \
 --name mynginx \
 --volume "$PWD/html":/usr/share/nginx/html \
 nginx
  • copy config file -> docker container cp mynginx:/etc/nginx .
  • copy folder nginx to current folder .
  • Other files
log:/var/log/nginx/
config:/etc/nginx/
project:/usr/share/nginx/html
  • enter into docker -> docker exec -it nginx /bin/bash

App

  • Gitlab
  • Seafile

rsync

Webfiles side

Header text Header text Header text
1. create config file
  • nano /etc/rsyncd.conf
2. Config
uid = nobody
gid = nobody
use chroot = no
max connections = 10
strict modes = yes
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[bk_files]
path = /backup/idehe.com
comment = backup idehe.com file
ignore errors 
read only = no
write only = no
hosts allow = *
hosts deny = 192.168.1.1
list = false
uid = root
gid = root
auth users = backup
secrets file = /etc/server.pass
  • backup user name backup
  • backup pass at /etc/server.pass
  • backup module [bk_files], inside folder is /backup/idehe.com
3. create secrete files
  • nano pass
  • backup:password
  • chmod 666 pass
  • maybe restart rsync --daemon
  • backup:password, user name and pass

Backup side

Steps Header text Header text
1. create secrete file
  • nano server.pass, and then type pass
  • chmod 600 server.pass
2. Main command
  • rsync -azvi --delete --progress backup@104.131.88.5::bk_files /backup/idehe.com/ --password-file=/backup/idehe.com.pass
  • rsync -azvi --delete --progress backup@168.235.94.174::bk_files /backup/szdxpy.cc/ --password-file=/backup/szdxpy.cc.pass
Example
3. Note config
  • -azvi
  • --delete delete file on this side
  • --progress show transfer progress
  • --exclude "*access*" --exclude "debug", exclude files
  • backup is rsync user name
  • 172.16.22.126 remote server
  • bk_files is backup module
  • /backup/idehe.com/ local folder
  • --password-file=/etc/server.pass, use pass
Example
4. setup cronteb -e
  • 00 01 * * * rsync -azvi --delete --progress backup@104.131.88.5::bk_files /backup/idehe.com/ --password-file=/backup/server.pass

Forum

Type alexa - prerequisite
vanilla 72K github - 1.7K PHP7
Carbon forum 687K github - 1.25K
phpbb 42K free
nodebb 189K github
smf 69K free
mybb 68K free
woltlab 115K free
discourse 35K github 2GB RAM min.
flarum 119K beta version now
fluxbb 661K non-free
IPS Board 44K non-free
xenforo 39K non-free
vbulletin 67K non-free

Mysqltuner

Reference tutorial

Pages in category "Web"

The following 11 pages are in this category, out of 11 total.