Proxmox container 'wordpress.test' (entfernt)
Status
- up and running as http://bytecluster0002.bytespeicher.org:8086
- has problems with loopback device cause the server can't reach itself with the external URL
Container setup
- image: debian10 with users
- 1. Netzwerkinterface
- eth0
- 10.2.0.30/24 DG: 10.2.0.254; fd00:10:2:0::30/64 DGfd00:10:2:0::0
- bridge: vmbr0
- 2. Netzwerkinterface:
- eth1,
- 10.3.0.30/24; fd00:10:3:0::30/64
- bridge: vmbr1
Ansible setup
- verbindet man sich als unpriviligierter user und möchte ein Command als ein anderer, unpriviligierter user ausführen (z.B. www-data), benötigt man
allow_world_readable_tmpfiles = yes
in der ansible.cfg, damit dies nicht als Fehler zum Abbruch führt.
Ansible Script
#!/usr/bin/env ansible-playbook - name: 'install nextcloud' hosts: wordpress become: true tasks: - name: remove apache2 apt: name: apache2 state: absent - name: install packages apt: pkg: - php7.3 - php7.3-xml - php7.3-mbstring - php7.3-zip - php7.3-mysql - php7.3-imagick - php7.3-curl - php7.3-fpm - nginx - name: Remove default nginx demo site file: path: /etc/nginx/sites-enabled/default state: absent - name: check if nextcloud is already installed stat: path: /var/www/wordpress register: wordpress_exists - name: Download wordpress and unpack unarchive: src: https://wordpress.org/latest.zip dest: /var/www owner: www-data group: www-data remote_src: yes when: not wordpress_exists.stat.exists - name: Remove file packed file file: path: /var/www/latest.zip state: absent - name: copy wordpress config copy: src: ./conf/wp-config.php dest: /var/www/wordpress/ owner: www-data group: www-data mode: '0644' - name: Download wp-cli wordpress command line interface get_url: url: https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar dest: /usr/local/bin/wp mode: '0777' - name: finish installation become_user: www-data become: yes shell: | wp core install --url='http://bytecluster0002.bytespeicher.org:8086' --title='Technikkultur Erfurt e.V. / Bytespeicher / Makerspace Erfurt' --admin_user=admin --admin_password=****** --admin_email='admin@technikkultur-erfurt.de' args: chdir: /var/www/wordpress/ - name: copy nginx config copy: src: ./conf/wordpress.conf dest: /etc/nginx/sites-available/ owner: root group: root mode: '0744' - name: Create a symbolic link file: src: /etc/nginx/sites-available/wordpress.conf dest: /etc/nginx/sites-enabled/wordpress.conf owner: root group: root state: link - name: load php-fpm systemd: state: restarted name: php7.3-fpm - name: Restart nginx systemd: state: restarted daemon_reload: yes name: nginx
Notizen
wp-config.php
- liegt unter /var/www/wordpress
<?php /** * The base configuration for WordPress * * The wp-config.php creation script uses this file during the * installation. You don't have to use the web site, you can * copy this file to "wp-config.php" and fill in the values. * * This file contains the following configurations: * * * MySQL settings * * Secret keys * * Database table prefix * * ABSPATH * * @link https://wordpress.org/support/article/editing-wp-config-php/ * * @package WordPress */ // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'wordpress' ); /** MySQL database username */ define( 'DB_USER', 'wp_user' ); /** MySQL database password */ define( 'DB_PASSWORD', 'wppass' ); /** MySQL hostname */ define( 'DB_HOST', '10.3.0.100:3306' ); /** Database Charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8' ); /** The Database Collate type. Don't change this if in doubt. */ define( 'DB_COLLATE', '' ); /**#@+ * Authentication Unique Keys and Salts. * * Change these to different unique phrases! * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again. * * @since 2.6.0 */ define('AUTH_KEY', '****************************************************************'); define('SECURE_AUTH_KEY', '****************************************************************'); define('LOGGED_IN_KEY', '****************************************************************'); define('NONCE_KEY', '****************************************************************'); define('AUTH_SALT', '****************************************************************'); define('SECURE_AUTH_SALT', '****************************************************************'); define('LOGGED_IN_SALT', '****************************************************************'); define('NONCE_SALT', '****************************************************************'); /**#@-*/ /** * WordPress Database Table prefix. * * You can have multiple installations in one database if you give each * a unique prefix. Only numbers, letters, and underscores please! */ $table_prefix = 'wp_'; /** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. * * For information on other constants that can be used for debugging, * visit the documentation. * * @link https://wordpress.org/support/article/debugging-in-wordpress/ */ define( 'WP_DEBUG', false ); /* That's all, stop editing! Happy publishing. */ /** Absolute path to the WordPress directory. */ if ( ! defined( 'ABSPATH' ) ) { define( 'ABSPATH', __DIR__ . '/' ); } /** Sets up WordPress vars and included files. */ require_once ABSPATH . 'wp-settings.php';
NGINX Config
server { listen 8086; listen [::]:8086; root /var/www/wordpress; index index.php index.html index.htm; server_name bytecluster0002.bytespeicher.org; error_log /var/log/nginx/wordpress.log; access_log /var/log/nginx/wordpress.log; client_max_body_size 100M; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.3-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }