Install nginx
1 |
sudo apt install nginx |
Install PHP
If you are installing the standard version of Ubuntu (without additional PPAs),
1 |
sudo apt install php php-fpm php-common php-mbstring php-xmlrpc php-gd php-xml php-mysql php-cli php-zip php-curl php-imagick |
Additional PPA
1 2 3 4 |
sudo apt install software-properties-common sudo add-apt-repository ppa:ondrej/php *If you get an error about python, disable IPv6 and run. sudo apt install php8.2 php8.2-fpm php8.2-common php8.2-mbstring php8.2-xmlrpc php8.2-gd php8.2-xml php8.2-mysql php8.2-cli php8.2-zip php8.2-curl php8.2-imagick |
Edit configuration file
Add index.php to the index directive in the server block.
1 |
index index.php index.html index.htm index.nginx-debian.html; |
Add (or edit) location block.
1 2 3 4 |
location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; } |
1 2 |
sudo nginx -t sudo systemctl reload nginx |
Install MariaDB
1 2 |
sudo apt install mariadb-server sudo mysql_secure_installation |
Enter current password for root (enter for none):
Enter the password currently set for the root user of MariaDB.
No password is set immediately after installation, so press ‘Enter’ key.
Switch to unix_socket authentication [Y/n]
Setting whether to switch to authentication using unix sockets.
Enter ‘n’ to not switch.
Change the root password? [Y/n]
Setting whether to change the password for the root user of MariaDB
Enter ‘y’ to set the password.
Set a password with ‘New password:’ and set the same password again with ‘Re-enter new password:’.
Remove anonymous users? [Y/n]
Setting whether to delete an anonymous user.
Enter ‘y’ to delete as it is not required.
Disallow root login remotely? [Y/n]
Setting to disallow remote login for the root user of MariaDB or not.
Enter ‘y’ to disallow.
Remove test database and access to it? [Y/n]
Set to delete the test database or not.
Enter ‘y’ to delete.
Reload privilege tables now? [Y/n]
Setting whether the user information settings should be reflected.
Enter ‘y’ if you want the settings to be reflected.
Using Basic Authentication
1 |
sudo apt install apache2-utils |
Create an authentication file (.htpasswd) and enter it in the server block configuration file.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
server { listen 80 default_server; server_name example.jp; root /usr/share/nginx/html; # authentication domain name auth_basic "Basic Authentication"; # Location of .htpasswd files auth_basic_user_file /etc/nginx/.htpasswd; ... } |
Issue SSL certificates with Let’s Encript
1 2 |
sudo apt install certbot python3-certbot-nginx sudo certbot --nginx -d example.com -d www.example.com |
Install phpMyAdmin
Install the phpMyAdmin package from the default Ubuntu repository using APT
1 |
sudo apt install phpmyadmin |
For the web server selection for installation, don’t select any options and press Enter to continue.
When asked if you want to use dbconfig-common to configure the application database, select . The internal database and phpMyAdmin admin user are set up. phpMyAdmin will ask you to define a new password for the MySQL user in phpMyAdmin, but this is not a password you need to remember, so leave it blank and let phpMyAdmin randomly You can leave it blank and let phpMyAdmin create a random password for you.
When completed, create a symbolic link to the nginx document root directory.
1 |
sudo ln -s /usr/share/phpmyadmin /var/www/your_domain/phpmyadmin |
Download and install phpMyAdmin
1 2 3 4 5 6 7 8 |
wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.tar.gz tar -zxvf phpMyAdmin-5.2.1-all-languages.tar.gz sudo mv phpMyAdmin-5.2.1-all-languages /var/www/phpmyadmin sudo mkdir /var/www/phpmyadmin/tmp sudo chmod 777 /var/www/phpmyadmin/tmp sudo chown -R www-data:www-data /var/www/phpmyadmin sudo cp /var/www/phpmyadmin/config.sample.inc.php /var/www/phpmyadmin/config.inc.php sudo nano /var/www/phpmyadmin/config.inc.php |
Generate a blowfish secret and update the following line in the configuration file with the generated string.
1 |
$cfg['blowfish_secret'] = '1{dd0`<Q),5XP_:R9UK%%8\"EEcyH#{o; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ |
1 |
sudo ln -s /var/www/phpmyadmin /var/www/html/phpmyadmin |
コメント