recently migrated wordpress to GCP, using cloud launcher – wordpress by bitnami. That pretty easy, google other tutorials and follow it. e.g. https://console.cloud.google.com/launcher/details/bitnami-launchpad/wordpress http://www.compoundtheory.com/migrating-my-blog-to-google-cloud-platform/ Set up here is some highlighted procedures 1. create compute engine via clound launcher 2. create cloud SQL – db username and password 3. mysqldump old wordpress database 4. load into cloud SQL 5. change wordpress setting. $ cd apps/wordpress/htdocs/ 6. turn off mysql in bitnami image
1 2 |
sudo /opt/bitnami/ctlscript.sh stop mysql sudo mv /opt/bitnami/mysql/scripts/ctl.sh /opt/bitnami/mysql/scripts/ctl.sh.disable |
7. turn off banner
1 |
sudo /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1 |
8. setup static IP for compute engine instance & cloud SQL in cloud SQL, allow CE’s IP 9. change DNS, point to GCP Issues outgoing email a bit weird, quite trouble to setup mailjet https://cloud.google.com/compute/docs/tutorials/sending-mail/ https://cloud.google.com/compute/docs/tutorials/sending-mail/using-mailjet followed the instructions, yet those postfix setup, from fields is <username>@<hostname>, which MailJet will send a verification email to, and apparently it won’t be verified. https://app.mailjet.com/account/sender additional steps to modified the email address, so it passes the verification. https://www.cyberciti.biz/tips/howto-postfix-masquerade-change-email-mail-address.html Then, setup wordpress plug-in https://docs.bitnami.com/google/apps/wordpress/#how-to-configure-outbound-email-settings php-fpm CPU loading unknown reason on high CPU usage. To restart php-fpm, or the HTTP server.
1 2 |
sudo /opt/bitnami/ctlscript.sh restart php-fpm sudo /opt/bitnami/ctlscript.sh restart apache |
more complicated than I thought, VMware Workstation patch and difficult to create ISO image. 1. macOS High Sierra 10.13 Beta 3 If you don’t have mac, you need to spend some time to find the source. check out https://betas.cmacapps.com/ to find a suitable one. Unzip the dmg file by 7zip, InstallESD.img & BaseSystem.dmg located in “macOS High Sierra Beta\Install macOS High Sierra Beta.app\Contents\SharedSupport” In PowerShell, compare their SHA-1 checksum to https://github.com/notpeter/apple-installer-checksums
1 2 |
Get-FileHash -Algorithm SHA1 InstallESD.dmg Get-FileHash -Algorithm SHA1 BaseSystem.dmg |
2. convert DMG to ISO unfortunately dmg2iso does not work, boot up failure. I only find people repack it on Mac OS. At the same time, I don’t like using third party vmdk image. So the work around is using 3rd party image to repack dmg to iso for vmware installation. 2.1 High Sierra vmdk image follow the instructions and download vmdk from Google drive only. https://techsviewer.com/install-macos-high-sierra-vmware-windows/ next, download the tools to unlock vmware from https://github.com/DrDonk/unlocker. It provides python script to patch, yet unfortunately it does not work well in python3, after converted by 2to3.py, still have modules missing, print sytax and str on buffer API …etc so just open command prompt with Admin right, then run win-install.cmd & win-update-tools.cmd , it will patch VMWare workstation for appleSMCTable about smc.version = 0 and smc.version = 1 After vmdk file downloaded, follow the installation instruction from the link above. 2.2 Bootable ISO image After installation completed, upload InstallESD.img & BaseSystem.dmg to macOS vm. I had upload the whole SharedSupport folder. Run the following script to create ISO file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#!/bin/bash ## Create bootable ISO from HighSierra 10.13db3 (17A306f) # Generate a BaseSystem.dmg with High Sierra Beta Installer Packages hdiutil attach ~/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/highsierra hdiutil create -o /tmp/HighSierraBase.cdr -size 7316m -layout SPUD -fs HFS+J hdiutil attach /tmp/HighSierraBase.cdr.dmg -noverify -mountpoint /Volumes/install_build asr restore -source ~/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation hdiutil detach /Volumes/OS\ X\ Base\ System/ hdiutil detach /Volumes/highsierra/ mv /tmp/HighSierraBase.cdr.dmg /tmp/BaseSystem.dmg # Restore the High Sierra Beta Installer's BaseSystem.dmg into file system and place custom BaseSystem.dmg into the root hdiutil create -o /tmp/HighSierra.cdr -size 8965m -layout SPUD -fs HFS+J hdiutil attach /tmp/HighSierra.cdr.dmg -noverify -mountpoint /Volumes/install_build asr restore -source ~/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase cp /tmp/BaseSystem.dmg /Volumes/OS\ X\ Base\ System rm /tmp/BaseSystem.dmg hdiutil detach /Volumes/OS\ X\ Base\ System/ hdiutil convert /tmp/HighSierra.cdr.dmg -format UDTO -o /tmp/HighSierra.iso mv /tmp/HighSierra.iso.cdr ~/HighSierraPublicBeta3.iso rm /tmp/HighSierra.cdr.dmg |
3. Configure another new VM Just ordinary VM creation. After finish config, don’t start vm yet. edit the vmx file, add smc.version = "0" to the file. Then now start the VM. select the ISO file created in step 2.2 as CD/DVD in virtual machine setting. Once boot up, open Disk Utility, Erase the hard disk, format as “Mac OS Extended (Journaled)“. Although High Sierra has new APFS, I am unsure how well it goes with vmware at this stage. Finally, quit Disk Utility, and select “Reinstall macOS”, and follow the installation prompt. After installation completed, dismount the CD-rom, and mount the darwin.iso which get from win-update-tools.cmd, to install VM-tools. 4. reference
1 2 3 4 5 |
https://github.com/notpeter/apple-installer-checksums#mac-osx-installers-sha1-checksums https://github.com/DrDonk/unlocker https://techsviewer.com/install-macos-high-sierra-vmware-windows/ https://gist.github.com/agentsim/00cc38c693e7d0e1b36a2080870d955b http://www.wikigain.com/download-macos-high-sierra-free/ |
MySQL PAM Config set up database table and column name for username and password # vim /etc/pam.d/nginx
1 2 3 4 5 6 7 8 9 10 11 12 |
auth required pam_mysql.so user=USERNAME_HERE \ passwd=PASSWORD_HERE \ host=HOSTNAME_HERE \ db=DATABASE_HERE \ table=TABLE_OR_VIEW_NAME_HERE \ usercolumn=USERNAME_COLUMN \ passwdcolumn=PASSWORD_COLUMN \ crypt=0 sqllog=0 # repeat .... with config above account required pam_mysql.so user=USERNAME_HERE \ ........ crypt=0 sqllog=0 # alternatively, to external config file # account required pam_mysql.so config_file=/etc/pam_mysql.conf |
in nginx config (/etc/nginx/nginx or /etc/nginx/conf.d/)
1 2 3 4 |
location /restricted { auth_pam "Restricted Zone" auth_pam_service_name "nginx" } |
Upload module config in nginx config (/etc/nginx/nginx or /etc/nginx/conf.d/)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
location /upload{ auth_pam "Restricted Zone" auth_pam_service_name "nginx" upload_pass /uploadHandler.php; # the location where the files are uploaded upload_store /var/tmp/fuploads; upload_store_access user:rw group:rw all:r; upload_resumable on; upload_state_store /var/tmp/fuploads/state ; # Set specified fields in request body # the field data will be available through the superglobal $_POST[] upload_set_form_field "${upload_field_name}_name" $upload_file_name; upload_set_form_field "${upload_field_name}_content_type" $upload_content_type; upload_set_form_field "${upload_field_name}_path" $upload_tmp_path; upload_cleanup 400 404 499 500-505; } # pass the PHP scripts to FastCGI server location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } |
php file upload handler example can be found on https://github.com/blueimp/jQuery-File-Upload/wiki/Uploading-to-nginx-using-the-nginx-upload-module-with-php_handler and https://github.com/blueimp/jQuery-File-Upload/tree/master/server/php