Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install PHP7.4 Nginx MariaDB Manuell for beginners #113

Open
marcbth opened this issue Jan 13, 2020 · 0 comments
Open

Install PHP7.4 Nginx MariaDB Manuell for beginners #113

marcbth opened this issue Jan 13, 2020 · 0 comments

Comments

@marcbth
Copy link

marcbth commented Jan 13, 2020

Install prerequisites for Debian Buster

PHP 7.4 Nginx Mariadb

PHP 7.4

Add SURY PHP Repository

PHP 7.4 is not available on the default Debian 10 APT repositories. As such you need to install the SURY PHP repository.

With SURY repos, you can install PHP 7.4 beta release for testing purposes.

Install the SURY Repository Signing Key

apt install gnupg2 -y
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -

Install the SURY Repository

echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.x.list

Update and upgrade your system packages

apt update
apt upgrade

Check the PHP 7.4 is available for installation.

apt-cache policy php7.4

Note: First install php7.4-fpm

apt-get install php7.4-fpm

Then

Nginx install

sudo apt-get install nginx php7.4-curl php7.4-gd php7.4-json php7.4-xml php7.4-mysql php7.4-mbstring imagemagick

Create nginx configuration
We’re going to create ompd as a standalone website which will be accessible through the address www.myompd.net
Note. This sets ompd as the default site on your machine. For most people this will be the best configuration. If you are someone who cares about what that means and understands what that means, then you already know how to add ompd as the non-default site. What is described here is the easiest setup, which will work for most people
Nginx comes set up with a default web site, which we don’t want to use. You used to be able to just delete it but now we can’t do that as it causes errors. So first we will edit the existing default config, since we don’t want it to be the default

sudo nano /etc/nginx/sites-available/default

Find the lines
listen 80 default_server;
listen [::]:80 default_server;

and change them to
l
listen 80;
listen [::]:80;

Explnanation: The reason we want to set ompd as the default site on the machine is so we can easily access it from any device just by typing the machine’s IP address into the browser

Then we will create the ompd config and set that to be the default

sudo nano /etc/nginx/sites-available/ompd

server {

listen 80 default_server;
listen [::]:80 default_server;

root /PATH/TO/OMPD;
index index.php index.html index.htm;

server_name www.myompd.net;

client_max_body_size 256M;

# This section can be copied into an existing default setup
location / {
    allow all;
    index index.php;
    location ~ \.php {
            try_files $uri index.php =404;
            fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            include /etc/nginx/fastcgi_params;
            fastcgi_read_timeout 1800;
    }
        }

}
Save the file (Ctrl-X in nano, then answer ‘Y’). Now link the configuration so it is enabled

sudo ln -s /etc/nginx/sites-available/ompd /etc/nginx/sites-enabled/ompd

Edit the hosts file
To make your browser capable of accessing www.myompd.net we need to edit your hosts file so the computer knows where www.myompd.net actually is.

On the computer where nginx is running you can use

sudo nano /etc/hosts

and just add the line

127.0.0.1 www.myompd.net

On any other device you will have to edit /etc/hosts but you will need to use the full IP address of the computer running the nginx server. On devices where this is not possible - eg a mobile device - you can just enter the IP address of the machine running nginx into your browser to access ompd, because we have set ompd as the default site.

Those of you who want to be clever and know how to edit hostname and DNS mapping on your router can do that, you will then not need ompd to be the default site and you will not need to edit the existing default config. Just remove default_server from the ompd configuration above and set server_name appopriately. If you didn’t understand that, then ignore this paragraph.

Edit PHP configuration

We need to edit the PHP configuration file. Again, note that there’s a version number in this path which you’ll need to make sure is correct

sudo nano /etc/php/7.4/fpm/php.ini

Now find and modify (or add in if they’re not there) the following parameters. Ctrl-W is ‘find’ in nano.

allow_url_fopen = On
memory_limit = 128M
max_execution_time = 1800

That’s all the configuring. Let’s get everything running

sudo systemctl restart php7.4-fpm
sudo systemctl restart nginx

Install Mariadb

apt-get install mariadb mariadb-common

then

mysql_secure_installation

Set root password Y
Remove anonymous user? Y
dissallow root login remotely N
Remove test database and access to it? Y
Reload privilege tables now? Y

Then

mysql -u root -p

Enter Password

select user,host,password,plugin from mysql.user;

update mysql.user set plugin='' where user='root';

flush privileges;

EXIT;

Then

Goto to your ip

*a part of the manual is taken over from rompr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant