Використовуючи цей сайт, ви погоджуєтеся з Політика конфіденційності.
прийняти
EnterinITEnterinITEnterinIT
  • ДІМ
  • IT PRO
  • ТЕХ
  • MICROSOFT
    • Лазурний
    • ConfigMgr/SCCM
    • DPM
    • Оркестрант
    • Hyper-V
    • Інсайдер Microsoft Edge
    • MSI
    • Офіс 365
    • Інсайдер Office
    • Power BI
    • Skype
    • SQL Server
    • Команди
  • ВІКНА
    • Центр адміністрування Windows
    • Клієнт Windows
    • Windows Server
  • Список колекції запитів SCCM
Читання: Install WordPress With Nginx on AlmaLinux 9
Зміна розміру шрифтуАа
EnterinITEnterinIT
Зміна розміру шрифтуАа
  • ДІМ
  • IT PRO
  • ТЕХ
  • MICROSOFT
  • ВІКНА
  • Список колекції запитів SCCM
Пошук
  • ДІМ
  • IT PRO
  • ТЕХ
  • MICROSOFT
    • Лазурний
    • ConfigMgr/SCCM
    • DPM
    • Оркестрант
    • Hyper-V
    • Інсайдер Microsoft Edge
    • MSI
    • Офіс 365
    • Інсайдер Office
    • Power BI
    • Skype
    • SQL Server
    • Команди
  • ВІКНА
    • Центр адміністрування Windows
    • Клієнт Windows
    • Windows Server
  • Список колекції запитів SCCM
Linux

Install WordPress With Nginx on AlmaLinux 9

Опубліковано лютий 4, 2024
7 Хв. читання
ПОДІЛИТИСЯ

In this tutorial, we will explain how to install WordPress with Nginx MariaDB on AlmaLinux 9/Rocky Linux 9. The tutorial will guide you to install and configure Nginx as the web server, PHP, and MariaDB as the database system.

WordPress is the most popular CMS (Content Management System). It is a free and open-source platform written in PHP and paired with a MySQL or MariaDB database for the backend.

Prerequisites:

  • An AlmaLinux 9 dedicated server or KVM VPS with root access or a normal user account with sudo privileges.
  1. Update the system:
sudo dnf update -y
  1. Install Nginx:
sudo dnf install nginx -y

Start and enable the Nginx service:

sudo systemctl start nginx && sudo systemctl enable nginx

Open the firewall for Nginx:

sudo firewall-cmd --add-service=http --permanent sudo firewall-cmd --reload
sudo firewall-cmd --add-service=https --permanent sudo firewall-cmd --reload
  1. Install MariaDB:

Add the MariaDB repository:

sudo vi /etc/yum.repos.d/mariadb.repo

Add the repo config:

[mariadb] name = MariaDB baseurl = https://rpm.mariadb.org/10.11/rhel/$releasever/$basearch gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck = 1

Install the package:

sudo dnf install mariadb-server -y

Start and enable MariaDB:

sudo systemctl start mariadb && sudo systemctl enable mariadb

Create a database and user:

mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';
GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit

MariaDB comes with a default root password that is not very secure. To secure MariaDB, run the following command:

sudo mysql_secure_installation

Follow the prompts to set a new root password, remove anonymous users, and disable remote root login.

  1. Install PHP:
sudo dnf install epel-release sudo dnf module install php:8.1 sudo dnf install php-fpm php-mysqlnd php-mbstring php-gd -y

Verify PHP installation:

php -v

Configure cgi.fix_pathinfo:

sudo vi /etc/php.ini

b. Uncomment the cgi.fix_pathinfo parameter by removing the semicolon (;) at the beginning of the line.

в. Set the value of cgi.fix_pathinfo to 0:

cgi.fix_pathinfo=0

d. Save and exit the php.ini file.

Restart php-fpm service:

sudo systemctl restart php-fpm
  1. Configure Nginx:
sudo vi /etc/nginx/conf.d/example.com.conf

Add config (update it with your data):

server {
    server_name server_domain_name_or_IP;
    root /var/www/wordpress;
    index index.html index.htm index.nginx-debian.html index.php;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; allow all; }
    location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
        expires max;
        log_not_found off;
    }
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php-fpm/www.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Test the configuration file.

sudo nginx -t

If there are no errors, restart the Nginx to make the necessary changes.

sudo systemctl restart nginx
  1. Get and extract WordPress:
cd /tmp curl -O https://wordpress.org/latest.tar.gz tar xzvf latest.tar.gz -C /var/www/ cd /var/www/wordpress/ cp wp-config-sample.php wp-config.php

Change the ownership to www-data user and group.

sudo chown -R nginx:nginx /var/www/wordpress/
  1. Configure wp-config.php:

Generate keys:

curl -s https://api.wordpress.org/secret-key/1.1/salt/

Copy the secret key and paste it into the WordPress configuration file wp-config.php.

sudo nano wp-config.php

Find the section that contains the dummy values for those settings.

It will look like:

define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');

Delete those lines and paste in the values you copied from the command line.

Set values:

nano wp-config.php

define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'password');
define('FS_METHOD','direct');
  1. Setup an SSL certificate (update it with your data):
sudo dnf install certbot python3-certbot-nginx sudo certbot --nginx -d example.com

Now that the WordPress files are downloaded and installed, we need to configure WordPress. To do this, open a web browser and navigate to your WordPress website. You should see the WordPress installation screen.

Follow the prompts to complete the WordPress installation. You will need to provide the following information:

  • Site Title: The name of your website.
  • Description: A brief description of your website.
  • Ім'я користувача: The username for your WordPress administration account.
  • Пароль: The password for your WordPress administration account.
  • Email Address: Your email address.

Once you have entered all of the information, натисніть Install WordPress кнопку. WordPress will be installed and you will be logged in to the WordPress administration dashboard.

Once you have installed WordPress, it is important to secure your installation.

ПОМІЧЕНО:AlmaLinuxCertbotdbdnfHTTPSLinuxMariaDBnanoNGINXSSLWordPress
Попередня стаття How To Install OpenSSL 3 on AlmaLinux 9
Наступна стаття Список колекції запитів диспетчера конфігурацій Configuration Manager Client Cache Cleanup Script
Залиште коментар Залиште коментар

Залиште відповідь Скасувати відповідь

Ваша електронна адреса не буде опублікована. Обов'язкові поля позначені *

Цей сайт використовує Akismet для зменшення спаму. Дізнайтеся, як обробляються дані ваших коментарів.

Переклад

English中文(简体)DanskNederlandsFrançaisDeutschItaliano한국어PolskiPortuguêsRomânăEspañolУкраїнська
 Редагувати переклад
за Transposh - translation plugin for wordpress

Популярні публікації

Системні вимоги для Windows Server 2016
Windows Server
Список колекції запитів диспетчера конфігурацій
Список колекції запитів диспетчера конфігурацій
ConfigMgr
Структуровану/керовану навігацію ввімкнено на сучасних сторінках класичних сайтів групи
техн
SCCM Не вдалося отримати розташування DP як очікувану версію від MP
ConfigMgr

Останні дописи

Встановлення та налаштування Fail2ban для захисту SSH на Ubuntu 24.04
Linux
Увімкнення та налаштування FirewallD на AlmaLinux
Linux
Створення користувача та налаштування ключа SSH в AlmaLinux
Linux
Як скинути пароль на AlmaLinux
Linux

© 2023 EnterinIT

Перейдіть до мобільної версії
рекламний банер
Ласкаво просимо назад!

Увійдіть у свій обліковий запис

Ім'я користувача або адреса електронної пошти
Пароль

Забули пароль?