This sample site was built on Azure VM, ubunti 18.04
Here're steps for setup:
- Update Ubuntu packages
- Install Apache
- Check disk space
- Start/ Reload/ Stop service on Azure Ubuntu
- Install MySQL
- Install PHP and WordPress
- Setup SSL
- Check Apache Role
- Setup FTP on Azure VM
Update Ubuntu packages before installation
Ref: https://tecadmin.net/upgrading-ubuntu-packages-command-line/
sudo update; sudo upgrade
Install Apache
Ref: https://ubuntu.com/tutorials/install-and-configure-apache#1-overview
sudo apt install apache2
When installation complete,
Root path of the website: /var/www/html/
Apache config folder: /etc/apache2/
On tutorial, it shows you how to create a virtual host. (We could see command a2ensite (to apply new config file) when setting up a WordPress Site.) I have blog sites hosted on blogspot.com which provide domain name reassignment. I setup their domain names on Google Domains (https://domains.google.com/), and use redirection on .access file.
Access control : /var/www/.htaccess
Redirect /index.html https://eblog.atfuture.ca/
Check disk space
Ref: https://www.linux.com/training-tutorials/6how-check-disk-space-linux-command-line/
Check current condition
df -H --output=source,size,used,avail
Check specific path
du -h /var/www/html
Start/ Reload/ Stop service on Azure Ubuntu
Ref: https://vitux.com/how-to-start-stop-or-restart-services-in-ubuntu/
Actually, Azure or AWS VM users don't really own root password. Command service might be out of reach. systemctl is practical one.
sudo systemctl start apache2
sudo systemctl status apache2
sudo systemctl restart apache2
sudo systemctl reload apache2
Install MySQL
Ref: https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04
sudo update; sudo upgrade
sudo apt install mysql-server
sudo mysql_secure_installation
setup password for MySQL root, and press 'Y' to the rest of questions
sudo mysql
....
mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
TEST:
MySQL Warning related:
Ref: https://dev.mysql.com/doc/refman/8.0/en/show-warnings.html
mysql> SHOW WARNINGS;
Install PHP and WordPress
Ref: https://ubuntu.com/tutorials/install-and-configure-apache#1-overview
(DON'T INSTALL WORDPRESS HERE. IT'S OUT OF DATE.)
Ref: https://wordpress.org/download/
Setup SSL
Check Apache Role
When wordpress encounter file system permission:
WordPress was run by PHP, which work under Apache. Setup WordPress folder to allowing the access from Apache's group. Usually online QAs would recommend to set the access mode to 755 which means wordpress run by the login account. It may be true if you're the client of wordpress.com. If you install the server on your own, the owner probably be root@localhost. The process executor is Apache. If you also use ftp, which, again, another account on server. It's not realistic to set wordpress access mode to 755. 775 (g+w) is more reasonable.
ps -ef | egrep '(httpd|apache2|apache)' | grep -v `whoami` | grep -v root | head -n1 | awk '{print $1}'
Setup FTP on Azure VM
Ref: https://dev.to/aloneguid/setting-up-ftp-server-on-microsoft-azure-2npb
Create an account for WordPress Owner
sudo adduser wpmgr
(setup password ...etc.)
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
define('WP_TEMP_DIR', ABSPATH . 'wp-content/tmp');
Comments
Post a Comment