Hosts specific configs
This commit is contained in:
132
On host/Wordpress.md
Normal file
132
On host/Wordpress.md
Normal file
@@ -0,0 +1,132 @@
|
||||
# Wordpress
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
<div class="table-wrapper" id="bkmrk-database-user-passwo"><table><tbody><tr><th colspan="1" rowspan="1">Database</th><th colspan="1" rowspan="1">User</th><th colspan="1" rowspan="1">Password</th><th colspan="1" rowspan="1">Host</th></tr><tr><td colspan="1" rowspan="1">wpugo</td><td colspan="1" rowspan="1">wordpress</td><td colspan="1" rowspan="1">wordpress</td><td colspan="1" rowspan="1">patrick:3306</td></tr><tr><td colspan="1" rowspan="1">`sudo rm /var/www/wpugo/readme.html`</td><td colspan="1" rowspan="1"> </td><td colspan="1" rowspan="1"> </td><td colspan="1" rowspan="1"> </td></tr></tbody></table>
|
||||
|
||||
</div>> add virtualhost to /etc/apache2/sites-available/ugo.delmar.bzh.conf
|
||||
|
||||
```conf
|
||||
<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';`
|
||||
|
||||
```bash
|
||||
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`
|
||||
|
||||
```bash
|
||||
systemctl reload apache2
|
||||
exit
|
||||
```
|
||||
|
||||
### Starting WP
|
||||
|
||||
#### Database infos
|
||||
|
||||
<div class="table-wrapper" id="bkmrk-website-database-nam"><table><tbody><tr><th colspan="1" rowspan="1">Website</th><th colspan="1" rowspan="1">Database</th><th colspan="1" rowspan="1">Name</th><th colspan="1" rowspan="1">Username</th><th colspan="1" rowspan="1">Password</th><th colspan="1" rowspan="1">Host</th><th colspan="1" rowspan="1">Prefix</th></tr><tr><td colspan="1" rowspan="1">wp1</td><td colspan="1" rowspan="1">wpjul</td><td colspan="1" rowspan="1">wordpress</td><td colspan="1" rowspan="1">28CWAm2yDy2PMVnU9ZwtxvNQ</td><td colspan="1" rowspan="1">db.lxd</td><td colspan="1" rowspan="1">wp\_</td><td colspan="1" rowspan="1"> </td></tr><tr><td colspan="1" rowspan="1">wp2</td><td colspan="1" rowspan="1">wpugo</td><td colspan="1" rowspan="1">wordpress</td><td colspan="1" rowspan="1">28CWAm2yDy2PMVnU9ZwtxvNQ</td><td colspan="1" rowspan="1">db.lxd</td><td colspan="1" rowspan="1">wp\_</td><td colspan="1" rowspan="1"> </td></tr></tbody></table>
|
||||
|
||||
</div>\#docker #apache #mariadb #server #cms #blog
|
||||
|
||||
### Fix upload\_max\_filesize directive
|
||||
|
||||
1. Get container ID : `sudo docker container ls --filter name='wordpress'`
|
||||
2. Update .htaccess file : `sudo docker container exec -it <Container ID> bash -c "echo 'php_value upload_max_filesize 256M' > '/var/www/html/.htaccess'"`
|
||||
|
||||
---
|
||||
|
||||
##### <span style="color: rgb(224, 62, 45);">**(!) In order to handle SEO url, include rewrite rules in [delmar.bzh.conf](https://bookstack.delmar.bzh/books/selfhosted/page/lamp "L.A.M.P")**</span>
|
||||
|
||||
## VirtualHost
|
||||
|
||||
```
|
||||
.
|
||||
├── apache
|
||||
| └── wordpress (82)
|
||||
└── mariadb
|
||||
```
|
||||
|
||||
`/etc/apache2/sites-available/delmar.bzh.conf`
|
||||
|
||||
```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>
|
||||
```
|
||||
Reference in New Issue
Block a user