It’s always a good idea to refresh repository and perform an update first.
sudo pacman -Syu
Nginx Web server: nginx and nginx-mainline. nginx is the more stable and older version and nginx-mainline is the latest version. You can install nginx In this Gist, I’m going to explain how you can install nginx-mainline
sudo pacman -S nginx-mainline
sudo systemctl start nginx
sudo systemctl status nginx
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl status nginx
sudo nginx -t
[warn] 15117#15117: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size
Open nginx configuration file and edit
sudo nano /etc/nginx/nginx.conf
Add these lines inside http block:
types_hash_max_size 4096;
server_names_hash_bucket_size 128;
Save and exit (CTRL+X, Y, Enter). Reload and test nginx:
sudo systemctl reload nginx
sudo nginx -t
nginx -v
sudo pacman -S mysql
directory prior to starting the service:
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
sudo systemctl enable mysqld
sudo systemctl start mysqld
sudo systemctl status mysqld
and set root password:
sudo mysql_secure_installation
or (sudo /usr/bin/mysql_secure_installation
)
sudo pacman -S php-fpm
nginx configuration file:
sudo nano /etc/nginx/nginx.conf
location / { /root /usr/share/nginx/html;
index index.html index.htm index.php;
}
and edit:
location ~ \.php$ {
root /usr/share/www;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
Save and close nginx configuration file after you have edited (CTRL+X, Y, Enter)
sudo systemctl start php-fpm
sudo systemctl enable php-fpm
create a test.php file in nginx web directory:
sudo nano /usr/share/www/test.php
(If you don’t have www directory in share folder, first you need to create one: sudo mkdir /usr/share/www
)
sudo systemctl reload nginx
http://localhost/test.php
or
http://127.0.0.1/test.php
You must see php version info page
sudo nano /etc/php/php.ini
;extension=bz2
;extension=curl
;extension=mysqli
;extension=pdo_dblib
;extension=pdo_mysql
;extension=pdo_odbc
;extension=pdo_pgsql
;extension=pdo_sqlite
;extension=zip
Save and close php.ini file
to take effect:
sudo systemctl reload php-fpm
sudo pacman -S phpmyadmin
system path to Nginx default root path:
sudo ln -s /usr/share/webapps/phpMyAdmin/ /usr/share/www/
sudo systemctl restart nginx
sudo systemctl restart php-fpm
If you get stuck somewhere or need any help, feel free to contact.
Thanks for Reading.
Thanks for the Guide