This is a WordPress Docker image which can run on both Azure Web App on Linux and your Docker engines's host.
This docker image currently contains the following components:
- WordPress
- Nginx (1.15.8)
- PHP (7.3.4)
- MariaDB ( 10.1.38/if using Local Database )
- Phpmyadmin ( 4.8.4/if using Local Database )
- Create a Web App for Containers
- Browse your site
- Complete WordPress install and Enter the Credentials for Azure database for MySQL
- Create a Web App for Containers
- Add new App Settings
| Name | Default Value |
|---|---|
| GIT_REPO | https://github.com/azureappserviceoss/wordpress-azure |
| GIT_BRANCH | linux_appservice |
- Browse your site
Note: GIT directory: /home/site/wwwroot.
Note: When you deploy it first time, Sometimes need to check wp-config.php. RM it and re-config DB information is necessary.
Note: Before restart web app, need to store your changes by "git push", it will be pulled again after restart.
- Create a Web App for Containers
- Update App Setting
WEBSITES_ENABLE_APP_SERVICE_STORAGE= true (If you like to keep you DB after restart.) - Add new App Settings
| Name | Default Value |
|---|---|
| DATABASE_TYPE | local |
| DATABASE_USERNAME | wordpress |
| DATABASE_PASSWORD | some-string |
Note: We create a database "azurelocaldb" when using local mysql . Hence use this name when setting up the app
Note: Phpmyadmin site is deployed when using local mysql. Please go to http://[website]/phpmyadmin, and login with DATABASE_USERNAME and DATABASE_PASSWORD.
- Browse your site
- Complete WordPress install
Note: Do not use the app setting DATABASE_TYPE=local if using Azure database for MySQL
- By default Xdebug is turned off as turning it on impacts performance.
- Connect by SSH.
- Go to
/usr/local/etc/php/conf.d, Updatexdebug.inias wish, don't modify the path of below line.zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so - Save
xdebug.ini, - Restart php-fpm by below cmd:
# find gid of php-fpm
ps aux
# Kill master process of php-fpm
kill -INT <gid>
# start php-fpm again
php-fpm -D && chmod 777 /var/run/php/php7.0-fpm.sock
- Xdebug is turned on.
- Go to "/etc/nginx", update config files as your wish.
- Reload by below cmd:
/usr/sbin/nginx -s reload
- By default, log rotate is disabled if deploy this images to web app for containers of azure. It's enabled if you use this image by "docker run".
- Log rotate is managed by crond, you can start it with below cmd, it will check logs files in the /home/LogFiles/nginx every minute, and rotate them if bigger than 1M. Old files are stored in /home/LogFiles/olddir, keep 20 backup files by default setting.
crond
- Please keep an eye on the log files, the performance will be going down if it's too big.
- If you don't like to start crond service to triage log rotate every minute, you also can manually triage it by below cmd as your wish, it will talk a while if these log files have already been too big.
logrotate /etc/logrotate.conf
If WEBSITES_ENABLE_APP_SERVICE_STORAGE = false ( which is the default setting ) , we recommend you DO NOT update the WordPress core version , themes or files from WordPress admin dashboard.
Choose either one option to updated your files :
There is a tradeoff between file server stability and file persistence . Since we are using local storage for better stability for the web app , you will not get file persistence. In this case , we recommend to follow these steps to update WordPress Core or a theme or a Plugins version :
- Fork the repo https://github.com/azureappserviceoss/wordpress-azure
- Clone your repo locally and make sure to use ONLY linux-appservice branch
- Download the latest version of WordPress , plugin or theme being used locally
- Commit the latest version bits into local folder of your cloned repo
- Push your changes to the your forked repo
- Login to Azure portal and select your web app
- Click on Application Settings -> App Settings and change GIT_REPO to use your repository from step #1. If you have changed the branch name , you can continue to use linux-apservice . If you wish to use a different branch , update GIT_BRANCH setting as well.
- Log-in to WordPress admin. In the left navigation, select Plugins, and then select Add New.
- Search Redis Object Cache, Click Install, wait, then click Activate.
- In the left navigation, select Plugins, and then select Installed Plugins.
- In the plugins page, find Redis Object Cache and click Settings.
- Click the Enable Object Cache button.
- WordPress connects to the Redis server. The connection status appears on the same page.
- More infomation about Redis Object Cache
- Some unexpected issues may happen after you scale out your site to multiple instances, if you deploy a WordPress site on Azure with this docker image and use the MariaDB built in this docker image as the database.
- The phpMyAdmin built in this docker image is available only when you use the MariaDB built in this docker image as the database.
- Please Include App Setting
WEBSITES_ENABLE_APP_SERVICE_STORAGE= true when use built in MariaDB since we need files to be persisted. - Set permalink as "Day and Name" by default. Peformance issue may happen with customized permalink. If like to use customized permalink, need to modify nginx configuration and remove lines of set_permalink() in wp-settings.php.
-
Version 0.8
- Upgrade php-fpm and nginx.
- Upgrade local mariadb.
- Update conf of php-fpm.
- Add Watch thread of php-fpm, kill STAT D child threads.
-
Version 0.72
- Fix Permission denied of log files issue of supervisord.
-
Version 0.71
- Upgrade php-fpm.
- Upgrade phpmyadmin.
- Add function log rotate. (It's disabed if deploy to web app of azure by default.)
- Php-fpm and nginx are watched by supervisord.
-
Version 0.7
- Upgrade php-fpm.
- Upgrade phpmyadmin.
- Add function log rotate. (It's disabed if deploy to web app of azure by default.)
- Php-fpm and nginx are watched by supervisord.
-
Version 0.61
- Imporve Performance.
-
Version 0.6
- Change to Nignx+fpm.
- Update version of php to 7.2.8.
-
Version 0.51
- Add PHP simleXML module.
- Bind php 7.1.7, avoid confuse of different php versions.
-
Version 0.5
- Add PHP redis extension.
- Add common debug tools, tcpdump/tcptraceroute.
- Fixed some Vulnerabilities.
-
Version 0.4
- Update version of Alpine/PHP/Apache/Mariadb.
- Redis-server is running by default.
- Reduce size.
-
Version 0.3
- Use Git to deploy wordpress.
- Update version of PHP/Apache/Mariadb/Phpmyadmin.
- Add Xdebug extenstion of PHP.
- Use supervisord to keep SSHD and Apache.
If you have feedback please create an issue but do not send Pull requests to these images since any changes to the images needs to tested before it is pushed to production.