Skip to content

Instantly share code, notes, and snippets.

@inspiretk
Last active April 24, 2024 19:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save inspiretk/24ef84e391ff03ecdebb65e60c111ad0 to your computer and use it in GitHub Desktop.
Save inspiretk/24ef84e391ff03ecdebb65e60c111ad0 to your computer and use it in GitHub Desktop.
Wordpress Ubuntu 18.04 Nginx
#!/bin/bash
# This script is to setup server, install nginx and setup, install Lets Encrypt
# run these commands below with root user, you can disable root user after you're done
### Put your ip below in SERVERIP
# nano serversetup.sh
# Copy everything in this script and paste it in, save file and exit
# chmod +x serversetup.sh
# ./serversetup.sh
# Put your ip, MySQL Username and password, and phpmyadmin url name below
SERVERIP=64.52.23.33
SERVERDOMAINNAME=cellardrop.com.au
PHPMYADMINNAME=pma_hidden
MYSQLNEWUSER=newuser
MYSQLNEWUSERPASSWORD=newuserpw4795
sudo apt update && sudo apt install nginx -y
#sudo service nginx status
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx HTTP'
sudo ufw enable
sudo ufw status
sudo apt update && sudo apt install mysql-server -y
#sudo service mysql status
echo -e "Setting up mysql_secure_installation"
sudo mysql_secure_installation
sudo apt update && sudo apt install php-fpm php-mysql -y
#php --version
#ls /var/run/php/
echo -e "Copy original nginx default file to /etc/nginx/sites-available/defaultoriginal"
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/defaultoriginal
echo -e "etc nginx sites-available default add index.php before index.html"
sudo sed -i '0,/index.html/ s/index.html/index.php index.html/' /etc/nginx/sites-available/default
echo -e "Changing server_name with your ip, find server_name _ and swap with server_name SERVERIP"
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/$SERVERDOMAINNAME
sudo sed -i "/server_name _;/c\server_name $SERVERDOMAINNAME www.$SERVERDOMAINNAME;" /etc/nginx/sites-available/$SERVERDOMAINNAME
echo -e "Find line, and replace entire line, removing the #, /include snippets/fastcgi-php.conf;, use \ before/ to pipe it out"
sudo sed -i '/include snippets\/fastcgi-php.conf;/c\include snippets\/fastcgi-php.conf;' /etc/nginx/sites-available/$SERVERDOMAINNAME
echo -e "For timeout upload, Find line fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; and replace with uncommented fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;"
sudo sed -i '/fastcgi_pass unix:\/var\/run\/php\/php7.0-fpm.sock;/c\fastcgi_pass unix:\/var\/run\/php\/php7.2-fpm.sock;\nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\nfastcgi_read_timeout 900;\ninclude /etc/nginx/fastcgi_params;\n}' /etc/nginx/sites-available/$SERVERDOMAINNAME
echo -e "location uncomment"
sudo sed -i '0,/#location ~ \\.php/ s/#location ~ \\.php/location ~ \\.php/' /etc/nginx/sites-available/$SERVERDOMAINNAME
echo -e "Nginx default file, find root /var/www/html; and change it to /var/www;"
sudo sed -i '/root \/var\/www\/html;/c\root \/var\/www\/html\/$SERVERDOMAINNAME;' /etc/nginx/sites-available/$SERVERDOMAINNAME
echo -e "Nginx update and reload"
sudo nginx -t
sudo service nginx reload
echo -e "Setup phpMyadmin"
sudo apt-get install phpmyadmin -y
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
echo -e "Rename phpmyadmin url to pma_hidden, and move to /var/www"
sudo mv /var/www/html/phpmyadmin /var/www/html/$PHPMYADMINNAME
echo -e "Fixing error screen in phpMyadmin import/export database, find if ($options != null && count($options) > 0) { and replace with if ($options != null && count((array)$options) > 0) {"
sudo sed -i "/if ($options != null && count($options) > 0) {/c\if ($options != null && count((array)$options) > 0) {" /usr/share/phpmyadmin/libraries/plugin_interface.lib.php
echo -e "php.ini configuration, upload_max_filesize, post_max_size, memory_limit, change /etc/php/7.2/fpm/php.ini, find text, then replace entire line"
sudo cp /etc/php/7.2/fpm/php.ini /etc/php/7.2/fpm/php.inibackup
sudo sed -i "/.*upload_max_filesize.*/c\upload_max_filesize = 1000M" /etc/php/7.2/fpm/php.ini
sudo sed -i "/.*post_max_size.*/c\post_max_size = 1000M" /etc/php/7.2/fpm/php.ini
sudo sed -i "/.*memory_limit.*/c\memory_limit = 328M" /etc/php/7.2/fpm/php.ini
sudo systemctl restart php7.2-fpm
sudo service nginx reload
echo -e "For errors 413 Request Entity Too Large"
echo -e "In nginx default file, Find line listen [::]:80 default_server;, then add new line after it"
sudo sed -i '/listen \[::\]:80 default_server;/c\listen \[::\]:80;\nclient_max_body_size 1000M;' /etc/nginx/sites-available/$SERVERDOMAINNAME
sudo service nginx reload
echo -e "In nginx.conf file, find first ##, and add 2 lines after it"
sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.confbackup
sudo sed -i '/http {/c\http {\nproxy_send_timeout 600;\nproxy_read_timeout 600;' /etc/nginx/nginx.conf
sudo systemctl restart php7.2-fpm
sudo service nginx reload
echo -e "Misc settings"
sudo sed -i '/listen \[::\]:80;/c\listen \[::\]:80;\nlocation = /favicon.ico { log_not_found off; access_log off; }\nlocation = /robots.txt { log_not_found off; access_log off; allow all; }\nlocation ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {\nexpires max;\nlog_not_found off; }' /etc/nginx/sites-available/$SERVERDOMAINNAME
echo -e "MySQL create user and password"
echo "Please enter root user MySQL password!"
read rootpasswd
mysql -uroot -p${rootpasswd} -e "CREATE USER '$MYSQLNEWUSER'@'%' IDENTIFIED BY '$MYSQLNEWUSERPASSWORD';"
mysql -uroot -p${rootpasswd} -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQLNEWUSER'@'%' WITH GRANT OPTION;"
sudo apt install php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip -y
echo -e "Set permission to folder /var/www for your websites"
sudo chmod -R 755 /var/www/html
sudo chown -R $(whoami):$(whoami) /var/www/html
sudo chown -R www-data:www-data /var/www/html
sudo apt install unzip -y
sudo ln -s /etc/nginx/sites-available/$SERVERDOMAINNAME /etc/nginx/sites-enabled/
sudo nginx -t
sudo service nginx restart
echo -e "Setup completed"
https://askubuntu.com/questions/1069130/running-multiple-sites-nginx-on-ubuntu-18-04
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/mytest1.com
sudo nano /etc/nginx/sites-available/mytest1.com
Scroll down and change this root /var/www/html; to root /var/www/mytest1.com/public_html
Change this server_name _; to server_name mytest1.com www.mytest1.com;
sudo ln -s /etc/nginx/sites-available/mytest1.com /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t
sudo service nginx restart
mkdir -p /var/www/site1
sudo chown -R www-data:www-data /var/www/site1
sudo systemctl reload nginx
sudo chown -R www-data:www-data /var/www/cellardrop.com
sudo systemctl reload nginx
# Transferring wordpress from hosted server to your vps ubuntu 18.04 nginx
### Setup your server vps ubuntu 18.04 nginx ###
# Run script ab Wordpress Script
# Prompt asks: Command may disrupt existing ssh connections. Proceed with operation
y
# Prompt asks: for mysql_secure_installation command:
n > enter pw > reenter pw > y > > y > y > y
# Prompt asks: Configuring phpmyadmin
Dont select any (apache2 or lighttpd), just press tab to go to ok and click enter
# Prompt asks: Configure database for phpmyadmin with dbconfig-common?
yes [press enter to select yes]
# MySQL application password for phpmyadmin
Enter your password
Reenter your password
# Once script is completed, do the following steps
## Check phpmyadmin is installed and working
Go to url your ip/pma_hidden
username: newuser
pasword: newuserpw4795
You should log in correctly. Make sure you create new user, and delete this user
# check ngix is working, go load your website up, has default ngix page
sudo mysqladmin -p -u root version [check install is correct]
ls /var/run/php/
# output php7.2-fpm.pid php7.2-fpm.sock # remember php7.2-fpm.sock
# Check php is installed: output should be PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
php --version
# Make sure nginx is setup correctly
nginx -t
### Zip your wordpress site ###
# zip your wordpress folder - all of it > Log into your control panel > File Manager > Select any site > Click public_html
# Select your site > Compress it
# You'll get a zip file on your server
# Move your zip file to your upload folder > wp-content > uploads
# Your zip file will be found https://yourwebsitedomain.com/wp-content/uploads/yourwebsitedomain.com.zip || Note your filename might be different
# log into your server > get this file to your server
wget https://yourwebsitedomain.com/wp-content/uploads/yourwebsitedomain.com.zip
### Copy your database ###
# Go to your control panel > phpMyAdmin > Find your database > Click on your database > Export > Go > Save it to your computer
# Transfer databasesql.zip file to your server: use your own method, or one below for Windows 7 (bit slow though)
# On your local machine (windows 7) > Open git bash > cd into the folder where you downloaded the database .sql file
# If you have ssh key setup: pscp -i "file of private key of server" sqlfilename.zip username@ip:/pwd file location/
pscp sqlfilename.sql.zip root@YourServerIP:/
# In your server
sudo reboot
cd /
# You should see your sqlfilename.sql.zip file
# Create your website database
Log into phpMyAdmin > Go to your web browser url YourServerIP/pma_hidden > Login Username newuser Password newuserpw4795 [or what you set it as in the Wordpress Script Setup New Server Ubuntu 18.04 Nginx] > Databases > Database name (enter your database name) > Database type utf8_general_ci > Click Create
# import database into mysql using command line
# Unzip your database
unzip DatabaseFile.sql.zip
mysql -u YourUserNameForMySQL -p DatabaseName < DatabaseFile.sql
mysql -u newuser -p smarttur_wp253 < smarttur_wp253.sql
unzip filename.zip # unzip file
mv name newname #rename file/folder
sudo mv nameoldlocation /new/location #move folder in current location to new location
# mysql change site url [wp_options > Check your table to see if this is named the same, if not change it. Find options, and should be that, with a prefix in front
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
# Memory size
root php.ini memory_limit =
wp-config.php > define( 'WP_MEMORY_LIMIT', '768M' );
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
client_max_body_size 1000M;
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off; }
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
#root /var/www/html;
#root /var/www/wordpress;
root /var/www/cellardrop;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name 64.52.23.33;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 900;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
# Transferring wordpress from hosted server to your vps ubuntu 18.04 nginx
### Setup your server vps ubuntu 18.04 nginx ###
# Run script ab Wordpress Script
# Once script is completed, do the following steps
# check ngix is working, go load your website up, has default ngix page
# for mysql_secure_installation command: n > enter pw > reenter pw > y > > y > y > y
sudo mysqladmin -p -u root version [check install is correct]
ls /var/run/php/
# output php7.2-fpm.pid php7.2-fpm.sock # remember php7.2-fpm.sock
MISC COMMANDS BELOW RESEARCH
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#sed -i '/fastcgi_pass unix:\/var\/run\/php\/php7.0-fpm.sock;/c\fastcgi_pass unix:\/var\/run\/php\/php7.2-fpm.sock;' /etc/nginx/sites-available/default
sed -i '/fastcgi_pass unix:\/var\/run\/php\/php7.0-fpm.sock;/c\fastcgi_pass unix:\/var\/run\/php\/php7.2-fpm.sock;\nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' /etc/nginx/sites-available/default
#sudo sed -e "0,|#location ~ \.php|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 900;" /etc/nginx/sites-available/default
#sudo sed -e "0,|#location ~ \.php|i include snippets/fastcgi-php.conf;|nfastcgi_pass unix:/var/run/php/php7.2-fpm.sock;|nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;|nfastcgi_read_timeout 900;" /etc/nginx/sites-available/default
#sudo sed -i "0,|#location ~ \.php|i include snippets/fastcgi-php.conf;|nfastcgi_pass unix:/var/run/php/php7.2-fpm.sock;|nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;|nfastcgi_read_timeout 900;" /etc/nginx/sites-available/default
#sudo sed -e '0,/#location ~ \.php/i include snippets///fastcgi-php.conf;/nfastcgi_pass unix:///var///run///php///php7.2-fpm.sock;/nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;/nfastcgi_read_timeout 900;' /etc/nginx/sites-available/default
#sudo sed '/^#location ~ \.php.*/a include snippets///fastcgi-php.conf;' /etc/nginx/sites-available/default
#sudo sed -i '0,/#location ~ \/a
#sudo sed -i '0,|# include snippets/fastcgi-php.conf;| s|include snippets/fastcgi-php.conf;|' /etc/nginx/sites-available/default
#sudo sed -i "0,/# include snippets/fastcgi-php.conf;/ s/include snippets/fastcgi-php.conf;/" /etc/nginx/sites-available/default
#sudo sed -i 0,/# include snippets/fastcgi-php.conf;/ s/# include snippets/fastcgi-php.conf;/include snippets/fastcgi-php.conf;/' /etc/nginx/sites-available/default
#sudo sed -i "0,/# include snippets/fastcgi-php.conf;/ s/# include snippets/fastcgi-php.conf;/include snippets/fastcgi-php.conf;/" /etc/nginx/sites-available/default
#sudo sed -i "|# include snippets/fastcgi-php.conf;| s|# include snippets/fastcgi-php.conf;/include snippets/fastcgi-php.conf;|" /etc/nginx/sites-available/default
#sed -i -e 's/# include snippets/fastcgi-php.conf;/include snippets/fastcgi-php.conf;/g' /etc/nginx/sites-available/default
#sed -i -e 's/# include snippets\/fastcgi-php.conf;/include snippets\/fastcgi-php.conf;/g' /etc/nginx/sites-available/default
#sed -i 's/# include snippets\/fastcgi-php.conf;/include snippets\/fastcgi-php.conf;/g' /etc/nginx/sites-available/default
sed -i 's/# include snippets\/fastcgi-php.conf;/include snippets\/fastcgi-php.conf;/' /etc/nginx/sites-available/default
sed -i 's\# include snippets/fastcgi-php.conf;\include snippets/fastcgi-php.conf;\' /etc/nginx/sites-available/default
sed -i '/include snippets\/fastcgi-php.conf;/c\include snippets\/fastcgi-php.conf;' /etc/nginx/sites-available/default
sed -i '/TEXT_TO_BE_REPLACED/c\This line is removed by the admin.' /tmp/foo
sed -e 's/#dir2/dir2/' /etc/ironman.d
# include snippets/fastcgi-php.conf;
# include snippets/fastcgi-php.conf;
# https://www.keycdn.com/support/413-request-entity-too-large
# sudo sed -e "0,|listen [::]:80 default_server;|i client_max_body_size 1000M;" /etc/nginx/sites-available/default
# sudo sed '/listen [::]:80 default_server;/a client_max_body_size 1000M;' /etc/nginx/sites-available/default
#sudo sed '0,/:80 default_server;/s//:80 default_server;\nclient_max_body_size 1000M;/' /etc/nginx/sites-available/default
#sudo awk '{print} /:80 default_server;/ && !n {print "client_max_body_size 1000M;"; n++}' /etc/nginx/sites-available/default
# sudo sed '24 a client_max_body_size 1000M;' /etc/nginx/sites-available/default
#sudo sed -i '24 a client_max_body_size 1000M;' /etc/nginx/sites-available/default
#sudo sed -i "|listen \[::\]:80 default_server;|i client_max_body_size 1000M;" /etc/nginx/sites-available/default
#sudo sed -i "s|listen \[::\]:80 default_server;|i client_max_body_size 1000M;|g" /etc/nginx/sites-available/default
### Zip your wordpress site ###
# zip your wordpress folder - all of it > Log into your control panel > File Manager > Select any site > Click public_html
# Select your site > Compress it
# You'll get a zip file on your server
# Move your zip file to your upload folder > wp-content > uploads
# Your zip file will be found https://yourwebsitedomain.com/wp-content/uploads/yourwebsitedomain.com.zip || Note your filename might be different
# log into your server > get this file to your server
wget https://yourwebsitedomain.com/wp-content/uploads/yourwebsitedomain.com.zip
### Copy your database ###
# Go to your control panel > phpMyAdmin > Find your database > Click on your database > Export > Go > Save it to your computer
https://www.youtube.com/watch?v=RpUDjVPOp-0
install wordpress on ubuntu 2018 with LEMP ( Linux, Nginx, MySQL, PHP)
# import database already
unzip filename.zip # unzip file
mv name newname #rename file/folder
sudo mv nameoldlocation /new/location #move folder in current location to new location
# setup multiple wordpress site on same server nginx ubuntu 18.04
https://askubuntu.com/questions/1069130/running-multiple-sites-nginx-on-ubuntu-18-04
sudo chmod -R 755 /var/www # set permission so pages can be served correctly
sudo chown -R $(whoami):$(whoami) /var/www/mytest1.com
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/mytest1.com
sudo nano /etc/nginx/sites-available/mytest1.com
Scroll down and change this root /var/www/html; to root /var/www/mytest1.com/public_html
Change this server_name _; to server_name mytest1.com www.mytest1.com;
Change this index index.html index.htm index.nginx-debian.html; to this index index.php index.html index.htm index.nginx-debian.html;
Run: ls ls /var/run/php/
Results: php7.2-fpm.pid php7.2-fpm.sock
...
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
...
sudo nginx -t
Do same for testsite2, but for testsite2 and more use this
/etc/nginx/sites-available/mytest2.com
listen 80 default_server;
listen [::]:80 default_server;
to
listen 80;
listen [::]:80;
sudo ln -s /etc/nginx/sites-available/mytest1.com /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t
sudo service nginx restart
mkdir -p /var/www/site1
sudo chown -R www-data:www-data /var/www/site1
sudo systemctl reload nginx
# mysql change site url
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
sudo apt install php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip
sudo chown -R www-data:www-data /var/www/site1
rm -r mydir #delete folder
ls -la # see permission of folder ls -la /folder/location
sudo chown -R $(whoami):$(whoami) /var/www/mytest1.com
chmod 755 directory_name #set permission folder
chmod 755 the_path_to_target drwxr-xr-x
find /opt/lampp/htdocs -type d -exec chmod 755 {} \; #just folders
# Wordpress Permission
https://stackoverflow.com/questions/18352682/correct-file-permissions-for-wordpress
chown www-data:www-data -R * # Let Apache be owner
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--
# After setup finish
chown <username>:<username> -R * # Let your useraccount be owner
chown www-data:www-data wp-content # Let apache be owner of wp-content
Good link:
https://youtu.be/4beEybPzYqQ
# Memory size
root php.ini memory_limit =
wp-config.php > define( 'WP_MEMORY_LIMIT', '768M' );
# timeout upload
vim /etc/nginx/sites-available/example.com
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_read_timeout 300;
}
libxml --version
php -i | grep -i simplexml
sudo apt-get install php-xml
– /etc/php/7.1/cli/conf.d/20-xmlwriter.ini
sudo systemctl restart php7.2-fpm
sudo service nginx reload
####
Change url in database options
comment out functions.php
install PHPMyAdmin on Nginx Ubuntu 18.04
https://youtu.be/pGc8DbJVupE How to Install Nginx, PHP, MySQL (LEMP) on Ubuntu 18.04
sudo apt update && sudo apt install nginx -y
sudo service nginx status
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx HTTP'
sudo ufw enable
sudo ufw status
check ngix is working, go load your website up, has default ngix page
sudo apt update && sudo apt install mysql-server -y
sudo service mysql status
sudo mysql_secure_installation
n > enter pw > reenter pw > y > > y > y > y
sudo mysqladmin -p -u root version [check install is correct
sudo apt update && sudo apt install php-fpm php-mysql -y
php --version
ls /var/run/php/
# output php7.2-fpm.pid php7.2-fpm.sock # remember php7.2-fpm.sock
sudo nano /etc/nginx/sites-available/default
# add index.php before index.html
# server_name put your ip;
# location ~ \.php uncomment it > include snippets/fastcgi-php.conf; > fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; > }
# make sure unix:/var/run/php/php7.0-fpm.sock; is same path as above php7.2-fpm.sock, if not change it
# fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
sudo nginx -t
sudo service nginx reload
sudo nano /var/www/html/info.php
# paste <?php on second line paste phpinfo();
# go to http://yourdomainorip/info.php # page should load with info
sudo rm /var/www/html/info.php
################ above successful ##################
Setup phpMyAdmin on nginx
https://youtu.be/NkzXu7p6lcI
sudo apt-get install phpmyadmin
# dont select any, just ok
https://devanswers.co/installing-phpmyadmin-nginx-ubuntu-18-04/
cd /usr/share
# check if phpmyadmin folder is there, if yes, cd to get back to root directory
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
# go to browser type in your ip/phpmyadmin and it will load the page
sudo mysql -p -u root
CREATE USER 'NewUser'@'%' IDENTIFIED BY 'password';
# can log in via webpage phpmyadmin with your new user login
quit
sudo mv /var/www/html/phpmyadmin /var/www/html/pma_hidden
# continue with extra security in that url page
https://linuxize.com/post/how-to-install-phpmyadmin-with-nginx-on-ubuntu-18-04/
GRANT ALL PRIVILEGES ON *.* TO 'NewUser'@'%' WITH GRANT OPTION;
exit
https://medium.com/@chaloemphonthipkasorn/%E0%B9%81%E0%B8%81%E0%B9%89-bug-phpmyadmin-php7-2-ubuntu-16-04-92b287090b01
sudo nano /usr/share/phpmyadmin/libraries/plugin_interface.lib.php
# search ctrl w if ($options != null && count($options) > 0) {
# change to if ($options != null && count((array)$options) > 0) {
# no more error screen in phpmyadmin import/export database
sudo nano /etc/php/7.2/fpm/php.ini
# search
upload_max_filesize = 1000M
post_max_size = 1000M
memory_limit = 328M
sudo systemctl restart php7.2-fpm
sudo service nginx reload
############################## above working ##################################
413 Request Entity Too Large
https://www.keycdn.com/support/413-request-entity-too-large
sudo nano /etc/nginx/sites-available/default
# In server block:
client_max_body_size 1000M;
sudo service nginx reload
sudo nano /etc/nginx/nginx.conf
proxy_send_timeout 600;
proxy_read_timeout 600;
sudo systemctl restart php7.2-fpm
sudo service nginx reload
mysql -u UserName -p
show databases;
use databasename;
drop database databasename;
############################# Ignore below, misc notes #################################
https://youtu.be/TPVIdNup2K4
sudo apt install php-gettext php-mbstring -y
sudo systemctl restart php7.2-fpm
sudo ln -s /usr/share/phpmyadmin/ /var/www/html/
ubuntu 18.04 install phpmyadmin on nginx
https://youtu.be/TPVIdNup2K4
sudo apt install php-gettext php-mbstring phpmyadmin -y
Select lighttpd > Yes to configure >
sudo apt install mysql-server -y
sudo /usr/bin/mysql_secure_installation
sudo service mysql start
sudo /usr/sbin/update-rc.d mysql defaults
sudo systemctl restart php7.2-fpm
sudo ufw enable
sudo ufw allow 'Nginx HTTP'
sudo ufw status
Remove apache2:
sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove
whereis apache2
sudo rm -rf /usr/sbin/apache2
sudo rm -rf /etc/apache2
sudo rm -rf /usr/share/apache2
sudo rm -rf /usr/share/man/man8/apache2.8.gz
sudo rm -rf /usr/lib/apache2
sudo nano /etc/nginx/snippets/phpmyadmin.conf
############# Copy paste below data in ###################
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
################### end of copy/paste #####################
# Mysql
mysql -u root -p
DROP DATABASE databasename;
create database databasename;
# ctrl d exit mysql
mysql -u username -p new_database < data-dump.sql
mysqldump --max_packet_size=2G -p username -p database > databasefile.sql
cd /etc/mysql/mysql.conf.d/ sudo nano mysqld.cnf
max_allowed_packet = 1600M
systemctl status mysql.service [see status of mysql]
sudo service mysql start [start mysql]
systemctl status mysql
[mysqld]
wait_timeout = 31536000
max_allowed_packet=2G
[mysqldump]
max_allowed_packet=2G
# Show pid
ps ax | grep mysql
# Transfer files
pwd
# On windows machine, put file pscp.exe into the folder > Open cmd and go to the folder
pscp -i "file of private key of server" filename username@ip:/pwd file location/
rm filename #remove file
gunzip file.gz #unzip .gz files
Ubuntu 18.04 Megasync Setup
https://github.com/megous/megatools
Wordpress local Windows 7 64bit
Wampserver64
# import mysql database file
https://stackoverflow.com/questions/14846879/import-sql-file-by-command-line-in-windows-7
C:\xampp\mysql\bin\mysql -u {username} -p {databasename} < file_name.sql
###### https://github.com/QROkes/webinoly ##########
## https://webinoly.com/en/tutorials/webinoly-full-example-tutorial/
https://webinoly.com/en/install/
HTML (1) – Only install Nginx, which will only support HTML sites.
PHP (2) – Nginx and Php will be installed.
LEMP (3) – A complete LEMP installation will be done, Nginx + Php + MySQL (MariaDB). This is the most complete and necessary configuration for WordPress sites.
Maybe later (0) – Webinoly is installed without installing any package, it allows you to do a manual and personalized installation with the command stack.
wget -qO weby qrok.es/wy && sudo bash weby 0
sudo webinoly -conf-value_max-mb-uploads=200
sudo webinoly -conf-value_nginx-ppa=mainline
sudo webinoly -timezone=America/Mexico_City
# Install LEMP;
sudo stack -lemp
# SFTP access to the server
sudo webinoly -login-www-data=on #
sudo webinoly -yoast-sitemap=off # disable Yoast SEO support in Webinoly
sudo webinoly -config-cache #FastCGI in Webinoly
sudo webinoly -clear-cache=fastcgi #clean/purge the cache
sudo log -only-error=on
sudo log mymainsite.com -only-error=on
sudo webinoly -tools-port=18915 #To access tools such as phpMyAdmin, Webinoly has port 22222 configured by default
sudo webinoly -tools-site=mymainsite.com # forced the use of the domain “mymainsite.com” to access the tools section
sudo webinoly -default-site=blackhole #no content will be served, nor will it respond to requests that do not correspond to an existing domain or site, for example, requests using the IP of the server.
# sudo webinoly -blockip=231.89.11.123 #block ip
# https://webinoly.com/en/documentation/sites/
# wget -qO weby qrok.es/wy && sudo bash weby <option> <tools-port/version>
# LEMP (3) – A complete LEMP installation will be done, Nginx + Php + MySQL (MariaDB). This is the most complete and necessary configuration for WordPress sites.
wget -qO weby qrok.es/wy && sudo bash weby 3 19816
# https://webinoly.com/en/documentation/sites/
## Create and manage your website
# sudo site <domain> <option> <option2>
# -html -php -wp -wpsubdir -wpsubdom -mysql -parked -proxy -on -off -delete -delete-all -subdomain -force-redirect -list -cache -ssl -root
# EG: sudo site example.com -html
# sudo site example.com -wp=default -cache=on
# sudo site example.com -cache=off
# sudo site example.com -parked=domain.com
# sudo site example.com -proxy=[localhost:8082]
# sudo site example.com -off
# sudo site example.com -ssl=on
# sudo site example.com -ssl=on -root=domain.com
# sudo site -list
# sudo site -delete-all
## WordPress installation script with custom data.
# sudo site example.com -wp=[<setup_db>,<setup_wp>,<host>,<dbname>,<dbuser>,<dbpass>,<wp_prefix>,<external_db_user>,<external_db_pass>]
sudo site example.com -wp=[true,true,localhost,example_com,example_user,password,wp_]
## To enable FastCgi:
sudo site domain.com -cache=on
sudo site domain.com -wp -cache=on
## How can I temporarily disable a site?
sudo site domain.com -on
sudo site domain.com -off
## Delete a website
sudo site domain.com -delete
## List sites
sudo site -list
## Force WWW or non-WWW in a site : Options: www root off
sudo site example.com -force-redirect=<options>
## SSL Certificates with Let’s Encrypt: Webinoly automatically checks once a week the status of the certificates of all your sites and those that have less than 30 days of validity period is automatically requested for its renewal. Therefore, you should not worry, since Webinoly automatically completes the process to keep your certificates and your sites always in force.
sudo site domain.com -ssl=on
## https://webinoly.com/en/documentation/webinolys/
sudo webinoly <option>
# -update -server-reset -verify -dbpass -tools-port -login-www-data -external-list-update -clear-cache -config-cache -default-site -tools-site -yoast-sitemap -blockip -conf-value_ -timezone -info -version -uninstall
# EG sudo webinoly -update
# sudo webinoly -login-www-data=on
# sudo webinoly -clear-cache=all
sudo webinoly -update #upgrade to the latest version of Webinoly
sudo apt update && sudo apt -y # upgrade at least once a month.
sudo webinoly -dbpass #Recover MySQL username and password. If you have modified the generated password, this command will not be able to recover it and some commands might not work correctly
## Access to PhpMyAdmin and other tools
# you can modify the access port (0-65535), by default we use port 22222 or the one you chose during the initial installation
sudo webinoly -tools-port
sudo webinoly -tools-port=19816
sudo webinoly -tools-site=domain.com
# access from your browser your tools using domain.com:19816
## Allow SFTP access to www-data user
sudo webinoly -login-www-data=on
# sudo webinoly -login-www-data=off #You can block the access at any time.
## FastCgi Cache settings
# HTTP Code 200: Successful requests.
# HTTP Code 301, 302, 307 and 404: Redirects and pages not found.
# Inactivity time: Remove cached data that has not been accessed in the specified time.
sudo webinoly -config-cache
# s – seconds m – minutes h – hours d – days w – weeks M – Months y – years
sudo webinoly -config-cache=[10d,1w,5m] #The first argument is the response for 200 codes, the second the downtime and the third for redirects.
## Clear/Purge Cache
# fastcgi redis memcached opcache all
EG sudo webinoly -clear-cache=fastcgi
sudo webinoly -clear-cache=all
sudo webinoly -timezone #eg sudo webinoly -timezone=America/Mexico_City timezone link http://php.net/manual/en/timezones.php
## Update, modify or reset server settings
# /opt/webinoly/webinoly.conf
# max-mb-uploads php-max-mem fd-ratio nginx-fd-ratio swap-mem nginx-ppa log-lines debug mail
sudo webinoly -conf-value_mail=user@mail.com #-conf-value_<variable>=<value>
## Configuration File
# max-mb-uploads – Defines the maximum size of an uploaded file, by default a value of 50MB is declared.
# php-max-mem – It establishes the memory limit that a PHP script can use, it is a direct adjustment to the memory_limit variable in the php.ini file.
# swap-mem – Webinoly automatically creates a SWAP memory partition, the size is determined based on the amount of RAM installed on your server.
# fd-ratio – Linux automatically configures the “file descriptors” limit based on system RAM. More or less it is based on 10% of the RAM taking 1kb for each file to calculate that value. This variable in the configuration file modifies the percentage of RAM taken to perform this calculation.
# nginx-fd-ratio – From the total of file descriptors calculated in the previous variable, the percentage assigned or allowed to be used or available for Nginx is calculated. That is, this variable is a percentage of the previous total.
# nginx-ppa – We can choose the option “mainline” or “stable”. This option only works before Nginx is installed.
# log-lines – It establishes the number of lines that the output of the log command will have, the default value is 10.
##################################
## # Numeric value in Megabytes
max-mb-uploads:100
php-max-mem:256
# Numeric value in Gigabytes
swap-mem:2
# Numeric value in % percentage
fd-ratio:50
nginx-fd-ratio:80
nginx-ppa:mainline
log-lines:20
debug:true
mail:hello@example.com
##########################
# mail:user@domain.com #debug:true
## Verify Webinoly integrity
sudo webinoly -verify
## Installation information
sudo webinoly -info
## Where is the PhpMyAdmin login page ## http://server.ip.com:22222/pma ## sudo webinoly -tools-port 65535
## Force manual ssl cert: Replace $domain and $mail with your own info.
sudo certbot certonly --manual --preferred-challenges=dns --manual-public-ip-logging-ok -d $domain -d *.$domain --email $mail --no-eff-email --agree-tos --staple-ocsp --must-staple
#!/bin/bash
# This script is to setup server Ubuntu 18.04 Nginx MySQL using webinoly script https://webinoly.com/en/tutorials/webinoly-full-example-tutorial/
### First change the settings below to your settings
# nano serverwebinoly.sh
# Copy everything in this script and paste it in, save file and exit
# chmod +x serverwebinoly.sh
# ./serverwebinoly.sh
####### Change settings below to your settings ################
## Find your timezone settings here: https://secure.php.net/manual/en/timezones.php ##
TIMEZONE=Australia/Perth
#SERVERDOMAINNAME=cellardrop.com.au
#DATABASENAME=cellardrop_com
#DATABASEUSERNAME=cellar
#DATABASEUSERPASSWORD=4795cellar
#DATABASEPREFIX=wp_
##############################################################
echo -e "Download webinoly and install option 0: Webinoly is installed without installing any packages"
wget -qO weby qrok.es/wy && sudo bash weby 0
sudo webinoly -conf-value_max-mb-uploads=200
sudo webinoly -conf-value_nginx-ppa=mainline
sudo webinoly -timezone=$TIMEZONE
echo -e "Installing LEMP: A complete LEMP installation will be done, Nginx + Php + MySQL (MariaDB). This is the most complete and necessary configuration for WordPress sites."
sudo stack -lemp
echo -e "Enable FastCGI in Webinoly [HttpCode 200 for valid pages cache 30 days,Cache for inactive pages,Cache valid for errors and redirections]"
sudo webinoly -config-cache=[30d,1w,5m]
echo -e "Logs only error messages"
sudo log -only-error=on
echo -e "No content will be served, nor will it respond to requests that do not correspond to an existing domain or site, for example, requests using the IP of the server."
sudo webinoly -default-site=blackhole
echo -e "Turn SFTP access to server ON, use for transferring files from local machine to server"
sudo webinoly -login-www-data=on
#echo -e "Create your website: site example.com -wp=[<setup_db>,<setup_wp>,<host>,<dbname>,<dbuser>,<dbpass>,<wp_prefix>,<external_db_user>,<external_db_pass>]"
#sudo site $SERVERDOMAINNAME -wp=[true,true,localhost,$DATABASENAME,$DATABASEUSERNAME,$DATABASEUSERPASSWORD,$DATABASEPREFIX]
#echo -e "Force non-WWW in site"
#sudo site $SERVERDOMAINNAME -force-redirect=root
echo -e "Create login for HTTP Auth login: Enter username and password to access your wordpress site for first startup accessing wp-admin config setting"
sudo httpauth -add
echo -e "Server setup complete"
#echo -e "List sites, make sure you can see your website $SERVERDOMAINNAME"
#sudo site -list
#!/bin/bash
# This script is to add website using webinoly script https://webinoly.com/en/tutorials/webinoly-full-example-tutorial/
### First change the settings below to your settings
# nano websitewebinoly.sh
# Copy everything in this script and paste it in, save file and exit
# chmod +x websitewebinoly.sh
# ./websitewebinoly.sh
####### Change settings below to your settings ################
## Find your timezone settings here: https://secure.php.net/manual/en/timezones.php ##
SERVERDOMAINNAME=cellardrop.com.au
DATABASENAME=cellardrop_com
DATABASEUSERNAME=cellar
DATABASEUSERPASSWORD=4795cellar
DATABASEPREFIX=wp_
##############################################################
echo -e "Create your website: site example.com -wp=[<setup_db>,<setup_wp>,<host>,<dbname>,<dbuser>,<dbpass>,<wp_prefix>,<external_db_user>,<external_db_pass>]"
sudo site $SERVERDOMAINNAME -wp=[true,true,localhost,$DATABASENAME,$DATABASEUSERNAME,$DATABASEUSERPASSWORD,$DATABASEPREFIX]
echo -e "Force non-WWW in site, so www forced to non-www"
sudo site $SERVERDOMAINNAME -force-redirect=root
echo -e "List sites, make sure you can see your website $SERVERDOMAINNAME"
sudo site -list
echo -e "IMPORTANT: IF you want to have SSL on your website for free using Lets Encrypt Free SSL, run this command sudo site $SERVERDOMAINNAME -ssl=on"
echo -e "SSL will auto install on your server for your website, and will add in cron job to auto renew for you"
echo -e "If auto renew doesn't work, run this command to get new ssl certificate: sudo certbot certonly --manual --preferred-challenges=dns --manual-public-ip-logging-ok -d $domain -d *.$domain --email $mail --no-eff-email --agree-tos --staple-ocsp --must-staple"
echo -e "Your wordpress files in following folders:"
echo -e "root /var/www/$SERVERDOMAINNAME/htdocs"
echo -e "wp config file /var/www/$SERVERDOMAINNAME/wp-config.php"
echo -e "error_log /var/log/nginx/$SERVERDOMAINNAME.error.log"
https://linuxize.com/post/how-to-install-nginx-on-ubuntu-18-04/
Installing Nginx
sudo apt update
sudo apt install nginx -y
# sudo systemctl status nginx
sudo ufw allow 'Nginx Full'
sudo ufw status
sudo systemctl stop nginx
sudo systemctl start nginx
#sudo systemctl restart nginx
#sudo systemctl reload nginx
#sudo systemctl enable nginx
https://linuxize.com/post/how-to-set-up-nginx-server-blocks-on-ubuntu-18-04/
How To Set Up Nginx Server Blocks on Ubuntu 18.04
sudo mkdir -p /var/www/example.com/public_html
nano /var/www/example.com/public_html/index.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Welcome to example.com</title>
</head>
<body>
<h1>Success! example.com home page!</h1>
</body>
</html>
sudo chown -R www-data: /var/www/example.com
nano /etc/nginx/sites-available/example.com
server {
listen 80;
listen [::]:80;
root /var/www/example.com/public_html;
index index.html;
server_name example.com www.example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
location / {
try_files $uri $uri/ =404;
}
}
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
https://linuxize.com/post/how-to-install-wordpress-with-nginx-on-ubuntu-18-04/
sudo apt update
sudo apt upgrade
#https://linuxize.com/post/how-to-create-mysql-user-accounts-and-grant-privileges/
#How to Create MySQL Users Accounts and Grant Privileges
#https://linuxize.com/post/how-to-install-mysql-on-ubuntu-18-04/
#How to Install MySQL on Ubuntu 18.04
sudo apt update
sudo apt install mysql-server -y
# sudo systemctl status mysql
sudo mysql_secure_installation
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'very_strong_password';
FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.* TO 'administrator'@'localhost' IDENTIFIED BY 'very_strong_password';
exit
# https://linuxize.com/post/how-to-create-mysql-user-accounts-and-grant-privileges/
# How to Create MySQL Users Accounts and Grant Privileges
# https://linuxize.com/post/how-to-install-wordpress-with-nginx-on-ubuntu-18-04/
# How to install WordPress with Nginx on Ubuntu 18.04
sudo apt install php7.2-cli php7.2-fpm php7.2-mysql php7.2-json php7.2-opcache php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl -y
sudo mkdir -p /var/www/html/example.com
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar xf latest.tar.gz
sudo mv /tmp/wordpress/* /var/www/html/example.com/
sudo chown -R www-data: /var/www/html/example.com
sudo nano /etc/nginx/sites-available/example.com
# Redirect HTTP -> HTTPS
server {
listen 80;
server_name www.example.com example.com;
include snippets/letsencrypt.conf;
return 301 https://example.com$request_uri;
}
# Redirect WWW -> NON WWW
server {
listen 443 ssl http2;
server_name www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
include snippets/ssl.conf;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl http2;
server_name example.com;
root /var/www/html/example.com;
index index.php;
# SSL parameters
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
include snippets/ssl.conf;
include snippets/letsencrypt.conf;
# log files
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
expires max;
log_not_found off;
}
}
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
https://youtu.be/75NDN00v55M
# Installing and setting up cygwin on windows 7
# Cygwin
# Download and install into c:/cygwin https://www.cygwin.com/
# copy setup-x86_64.exe to c:/cygwin > rename this file to setup.exe (easier to use for later commands)
# Run cmd on your windows machine > Click start button > type cmd > right click it and open as Administrator > type
cd c:/cygwin
# install some programs, type below
setup.exe -q -P wget,tar,qawk,bzip2,subversion,vim
# install will finish when it says Ending cygwin install. Type dir to refresh directory to confirm it's finished
setup.exe
# Go through process again, this time search for program cygrunsrv > Top left hand corner click next to View > Select Full > In column New > Click arrow and select the version number you want > make sure Bin and Src box is selected > Cick Next > install it
# do same for nano; openssh;
# In cygwin terminal:
ssh-host-config -y
cygrunsrv -S sshd
# rsync commands
rsync -rt --verbose --no-perms /cygdrive/c/atest /cygdrive/c/at3
rsync -rt --verbose --no-perms root@ServerIP:/var/www/WebsiteFolder /cygdrive/c/at4
rsync -rt --verbose --no-perms --delete /cygdrive/c/atest /cygdrive/c/at5 #master slave --delete to remove files deleted from master and delete from slave
# force a delete
cygstart --action=runas rm -r at2
# Run the cygwin terminal > Should be a desktop icon called Cygwin64 Terminal > Double click it > type
cd c:/cygwin
ls # type this and you'll see a list of files/folders
pwd # see your folder path location
svn --force export http://apt-cyg.googlecode.com/svn/trunk/ /bin/
# Download putty > run putty
# Setup cygwin sshd https://youtu.be/75NDN00v55M?t=239
ssh-host-config -y
######### cron
https://stackoverflow.com/questions/707184/how-do-you-run-a-crontab-in-cygwin-on-windows
install cygrunsrv
cron-config
misc: not needed below
https://github.com/DonyorM/weresync
https://github.com/bup/bup
# point dns to new server
copy website folder to /root
copy database to /root/folder
cd
nano websitewebinoly.sh
# Update server name details website > save file
./websitewebinoly.sh
unzip websitefile
# Move config file
cd /var/www/cellardrop.com
mv wp-config.php wp-config.phpbackup
cd cellardrop.com
mv wp-config.php /var/www/cellardrop.com/
# delete everything inside new folder
rm -r /var/www/cellardrop.com/htdocs/*
# move website folder to new folder
cd
cd cellardrop.com
mv -v * /var/www/cellardrop.com/htdocs/
# create database user and pw
log into phpMyAdmin > Open your browser > type in your ip:22222/pma > put in root > and your password (generated when you created your server with webinoly)
create your database > database name > utf 8 general
# create database
mysql -u root -p
create database database;
# DROP DATABASE databasename;
# upload database
# import database into mysql using command line
# Unzip your database
cd cd
unzip database.sql.zip
mv database.sql /root
mysql -u root -p database < database.sql;
# unzip database file
log into pma > browser url > ServerIP:22222/pma > select database > import > find file > go
https://stackoverflow.com/questions/13717277/how-can-i-import-a-large-14-gb-mysql-dump-file-into-a-new-mysql-database
cd..
cd..
f: -- xampp installed drive
cd xampp/mysql/bin
mysql -u root -p
CREATE DATABASE DATABASE_NAME CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# utf8mb4_unicode_ci
set global net_buffer_length=1000000; --Set network buffer length to a large byte number
set global max_allowed_packet=1000000000; --Set maximum allowed packet size to a large byte number
SET foreign_key_checks = 0; --Disable foreign key checking to avoid delays,errors and unwanted behaviour
use DATABASE_NAME;
source G:\file.sql; --Import your sql dump file
SET foreign_key_checks = 1; --Remember to enable foreign key checks when procedure is complete!
504 Gateway Time-out nginx
https://webinoly.com/support/897/phpmyadmin-export-returns-504-gateway-time-out
Try increasing fastcgi_read_timeout value, if it doesn't work you can play with the send_timeout value and also I'm not sure, but maybe keepalive_timeout value too.
Don't forget restart nginx service to changes can take effect.
fastcgi_read_timeout
send_timeout
keepalive_timeout
rsync -rt --verbose --no-perms /cygdrive/c/cd2 root@64.52.23.33:/root
rsync -rt --verbose --no-perms --progress /cygdrive/c/cd2 root@64.52.23.33:/root
sudo webinoly -conf-value_max-mb-uploads=20000
sudo webinoly -server-reset
sudo webinoly -info
sudo webinoly -verify
sudo webinoly -conf-value_php-max-mem=2560 # increase php memory limit
sudo webinoly -server-reset=php
mysql -u root -p database < database.sql
mysql -p -u root database < database.sql
mysql -u YourUserNameForMySQL -p DatabaseName < DatabaseFile.sql
mysql -u root -p database < database.sql
nano /opt/webinoly/webinoly.conf
https://webinoly.com/en/documentation/webinolys/
Only below can be modified
max-mb-uploads php-max-mem fd-ratio nginx-fd-ratio swap-mem nginx-ppa log-lines debug mail
sudo webinoly -conf-value_mail=user@mail.com
sudo stack -pma -purge # uninstall PMA
# setup ssl
###
echo -e "Your wordpress files in following folders:"
echo -e "root /var/www/$SERVERDOMAINNAME/htdocs"
echo -e "wp config file /var/www/$SERVERDOMAINNAME/wp-config.php"
echo -e "error_log /var/log/nginx/$SERVERDOMAINNAME.error.log"
chown -Rf www-data.www-data /var/www/site/htdocs/
/etc/mysql/my.cnf
max_allowed_packet=
service mysql restart
https://webinoly.com/en/documentation/httpauthe/
sudo httpauth -delete
sudo httpauth -wp-admin-off
# wordpress how to reduce database size
- delete unwanted plugins > delete unwanted code >
# how to find unused tables in your database
- Delete Leftover Plugin Database Tables > https://wordpress.org/plugins/plugins-garbage-collector/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment