ArchLinux:Nginx: Difference between revisions
m (→NGINX) |
No edit summary |
||
Line 19: | Line 19: | ||
{{margin}} | {{margin}} | ||
{{Console|1=sudo gpasswd -a {{cyanBold|username}} http}} | {{Console|1=sudo gpasswd -a {{cyanBold|username}} http}} | ||
== {{Icon|notebook}} PostgreSQL == | == {{Icon|notebook}} Database == | ||
=== PostgreSQL === | |||
Using {{mono|postgresql}} as a back-end will require the following setup and configuration. | Using {{mono|postgresql}} as a back-end will require the following setup and configuration. | ||
{{Console|1=pikaur -S postgresql php-pgsql}} | {{Console|1=pikaur -S postgresql php-pgsql}} | ||
Line 42: | Line 43: | ||
Create a new postgres user account. | Create a new postgres user account. | ||
{{Console|1=createuser -P --interactive<br/>Enter name of role to add: {{cyanBold|username}}<br/>Enter password for new role: {{cyanBold|********}}<br/>Enter it again: {{cyanBold|********}}<br/>Shall the new role be a superuser? (y/n) {{cyanBold|n}}<br/>Shall the new role be allowed to create databases? (y/n) {{cyanBold|y}}<br/>Shall the new role be allowed to create more new roles? (y/n) {{cyanBold|n}}}} | {{Console|1=createuser -P --interactive<br/>Enter name of role to add: {{cyanBold|username}}<br/>Enter password for new role: {{cyanBold|********}}<br/>Enter it again: {{cyanBold|********}}<br/>Shall the new role be a superuser? (y/n) {{cyanBold|n}}<br/>Shall the new role be allowed to create databases? (y/n) {{cyanBold|y}}<br/>Shall the new role be allowed to create more new roles? (y/n) {{cyanBold|n}}}} | ||
=== MariaDB === | |||
== | |||
Using {{mono|mariadb}} as a back-end will require the following setup and configuration. | Using {{mono|mariadb}} as a back-end will require the following setup and configuration. | ||
{{Console|1=pikaur -S mariadb}} | {{Console|1=pikaur -S mariadb}} | ||
Line 65: | Line 65: | ||
Add a new mysql user account. | Add a new mysql user account. | ||
{{Console|1=MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO '{{cyanBold|kyau}}'@'localhost' IDENTIFIED BY '{{cyanBold|user_password}}' WITH GRANT OPTION;}} | {{Console|1=MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO '{{cyanBold|kyau}}'@'localhost' IDENTIFIED BY '{{cyanBold|user_password}}' WITH GRANT OPTION;}} | ||
== {{Icon|notebook}} Configuration == | |||
[[Category:Arch Linux]] | [[Category:Arch Linux]] |
Revision as of 12:28, 1 May 2021
Introduction
NGINX
Beforehand be sure to determine weather the web server will be using MySQL (ie. MariaDB) or PostgreSQL.
Begin by installing NGINX, PHP and other required utilities.
# pikaur -S apache-tools composer curl minify nginx php-fpm sassc wget |
Install all of the required PHP extensions.
# pikaur -S php-gd php-geoip php-imagick php-intl php-memcache php-odbc php-sqlite php-sodium xdebug |
Next create the environment for the web server.
# sudo mkdir -p /nginx/conf.d /nginx/https /nginx/logs /nginx/sql /nginx/ssl /nginx/vhosts.d |
# sudo chmod -R 770 /nginx |
# sudo chmod 750 /nginx/sql |
# sudo gpasswd -a username http |
Database
PostgreSQL
Using postgresql as a back-end will require the following setup and configuration.
# pikaur -S postgresql php-pgsql |
# sudo chown postgres:postgres /nginx/sql |
# sudo gpasswd -a username postgres |
Swap over to the postgresql user account.
# sudo -iu postgres |
Run the database initialization.
# initdb --locale en_US.UTF-8 -E UTF8 -D '/nginx/sql/data' |
Return to the normal user account.
# exit |
Modify the systemd service file to reflect the new data directory.
# sudo systemctl edit postgresql.service |
Environment=PGROOT=/nginx/sql PIDFile=/nginx/sql/postmaster.pid |
Start and enable the systemd service.
# sudo systemctl enable --now postgresql.service |
Swap back over to the postgresql user account.
# sudo -iu postgres |
Create a new postgres user account.
# createuser -P --interactive Enter name of role to add: username Enter password for new role: ******** Enter it again: ******** Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) y Shall the new role be allowed to create more new roles? (y/n) n |
MariaDB
Using mariadb as a back-end will require the following setup and configuration.
# pikaur -S mariadb |
# sudo chown mysql:mysql /nginx/sql |
Give the current logged in user access.
# sudo gpasswd -a username mysql |
Create and initialize the data directory.
# mariadb-install-db --user=mysql --basedir=/usr --datadir=/nginx/sql |
# sudoedit /etc/my.cnf.d/server.cnf |
[mysqld] datadir=/nginx/sql |
Start and enable the MySQL service.
# sudo systemctl enable --now mariadb.service |
Secure the installation and set the root password.
# sudo mysql_secure_installation |
The default mysql root password is none |
Connect to mysql using the root account and the password you previously set.
# sudo mysql -u root -p |
Add a new mysql user account.
# MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'kyau'@'localhost' IDENTIFIED BY 'user_password' WITH GRANT OPTION; |