5.2 KiB
5.2 KiB
Wordpress
sudo apt update && apt full-upgrade -y
sudo apt install apache2 wget curl git php libapache2-mod-php php-cli php-mysql php-zip php-curl php-xml php-json php-gd php-intl php-mbstring php-imagick php-fpm php-dom php-gd php-imagick -y
apache
wpugo
wget https://wordpress.org/latest.tar.gz --directory-prefix=/tmp/
sudo tar xvfa /tmp/latest.tar.gz -C /var/www/wpugo/ --strip-components=1
sudo chown -R www-data:www-data /var/www/wpugo/
sudo rm /var/www/wpugo/index.nginx-debian.html
sudo cp wordpress/wp-config-sample.php wordpress/wp-config.php
edit wordpress/wp-config.php with database infos
| Database | User | Password | Host |
|---|---|---|---|
| wpugo | wordpress | wordpress | patrick:3306 |
| `sudo rm /var/www/wpugo/readme.html` |
<VirtualHost *:82>
ServerName ugo.delmar.bzh
DocumentRoot /var/www/wpugo
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
vim /var/www/html/wp-admin/setup-config.php
Add before line 20 (20 gg)
> $_SERVER['HTTPS']='on';
sudo vim /var/www/html/wp-config-sample.php
Add before line 82 (82 gg)
$_SERVER['HTTPS']='on';
sudo chmod -v 666 /var/www/wpugo/.htaccess
sudo a2ensite ugo.delmar.bzh.conf
sudo a2dissite 000-default
apache2ctl configtest
# Redirection vers HTTPS
RewriteCond %{SERVER_PORT} ^8082$ [OR]
RewriteCond %{HTTPS} =off
RewriteRule ^(.*)$ https://ugo.delmar.bzh/$1 [R=301,L]
# Redirection du non-www vers www en HTTPS
RewriteCond %{HTTP_HOST} ^delmar.bzh [NC]
RewriteRule ^(.*)$ https://ugo.delmar.bzh/$1 [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
sudo vim /etc/apache2/mods-enabled/dir.conf
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
systemctl reload apache2
exit
Starting WP
Database infos
| Website | Database | Name | Username | Password | Host | Prefix |
|---|---|---|---|---|---|---|
| wp1 | wpjul | wordpress | 28CWAm2yDy2PMVnU9ZwtxvNQ | db.lxd | wp\_ | |
| wp2 | wpugo | wordpress | 28CWAm2yDy2PMVnU9ZwtxvNQ | db.lxd | wp\_ |
Fix upload_max_filesize directive
- Get container ID :
sudo docker container ls --filter name='wordpress' - Update .htaccess file :
sudo docker container exec -it <Container ID> bash -c "echo 'php_value upload_max_filesize 256M' > '/var/www/html/.htaccess'"
(!) In order to handle SEO url, include rewrite rules in delmar.bzh.conf
VirtualHost
.
├── apache
| └── wordpress (82)
└── mariadb
/etc/apache2/sites-available/delmar.bzh.conf
<VirtualHost *:82>
ServerName ugo.delmar.bzh
ServerAdmin ugo@delmar.bzh
DocumentRoot /var/www/wpugo
<Directory /var/www/wpugo>
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
allow from all
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>