Setting up a web server with AlmaLinux 9

Enable sudo for the specified user

Method 1

Run the command visudo and open /etc/sudoers,

If the following line is commented out, uncomment it and do the same as below.

Add the target user to the ‘wheel’ group.

Method 2

Run the command visudo and open /etc/sudoers,

Add to the following line in the root configuration.

Enabling sudo in WinSCP

If you are using WinSCP and want to enable file editing on the remote server with root privileges, configure as follows.

WinSCP

Environment, SFTP, Protocol Options, SFTP Server (V), sudo /usr/libexec/openssh/sftp-server.

Installing Apache2

Install Apache. Also install the ssl module to enable SSL.

Configure Apache to start automatically at system start-up.

Allow http in firewalls

Installing MariaDB

initialisation

To configure the service to start automatically, use the following command.

Installing PHP

To install PHP, which comes as standard, use the following command:

*Since CentOS 8, when PHP-FPM is installed, the CGI version is invoked by Apache, not the modular version.

When using a version other than the standard installed version

Adding a repository.

If PHP 5.6 is used, use the Raven repository.

If PHP 7.4 or later is used, use the Remi repository.

Install PHP 7.4

To install other versions such as PHP 8.1:

Switch between multiple versions of PHP per virtual host

Edit /etc/opt/remi/php[version]/php-fpm.d/www.conf if you installed by version with Remi.

Configuration of PHP 7.4

Configure virtual host settings in /etc/httpd/conf.d/vhost.conf etc.

Restart php-fpm and the Apache service for the configuration to take effect.

Running PHP as different users

Copy /etc/opt/remi/php[version]/php-fpm.d/www.conf and create user1.conf using the following command.
*If you have installed multiple versions of PHP with Remi.

Rewrite the following parts of the file.

Restart PHP-FPM.

A socket file php7.4-fpm-user1.sock will be created in /run/php-fpm/.

Add the following to the Apache configuration file.

Restart Apache

phpMyAdmin installation

Enabling the EPEL repository

Install phpMyAdmin

Restart Apache

By default, only connections from the local host are allowed to the area where phpMyAdmin is installed, and not remotely. phpMyAdmin configuration file /etc/httpd/conf.d/phpMyAdmin.conf, open it and configure Apache.

Restart Apache

コメント

タイトルとURLをコピーしました