[HOWTO] Install LEMP (nginx + mariadb + php)

Here you'll find a place for solutions and hints.

Please use one of the support subforums below for questions or if you have any issues and need support.

[HOWTO] Install LEMP (nginx + mariadb + php)

Postby alket » Sep 18th, '15, 23:15

1. First install nginx
1.1 urpmi nginx
1.2 After install, navigate to localhost, a default page should greet you.

2. Install MariaDB
2.1 Run: urpmi mariadb
2.2 Run: mysql_install_db
2.3 Run: mysql_secure_installation

3. Install PHP
3.1 Run: urpmi php-fpm php-mysql php-mysqli php-mysqlnd
3.2 At file /etc/php-cgi-fcgi.ini change cgi.fix_pathinfo from 0 to 1 (line 769)
3.3 Run: service php5-fpm restart
3.4 Edit file /etc/php-fpm.conf and change line 176, 177 and 178 to this:
listen.owner = nginx
listen.group = nginx
listen.mode = 0660

4. Configure nginx
4.1 Edit file /etc/nginx/conf.d/default.conf , at the end should look like this.
NOTE: I have used /home/USER/Documents/www as my Document directory, you should change those to your preferences.
Code: Select all
server {
        listen   80;


        root /home/USER/Documents/www;
        index index.php index.html index.htm;

        server_name localhost;

        location / {
                try_files $uri $uri/ /index.html;
        }

        error_page 404 /404.html;

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
              root /home/USER/Documents/www;
        }

        # pass the PHP scripts to FastCGI server listening on the php-fpm socket
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/lib/php-fpm/php-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;

        }

}

4.2 Run: service nginx restart

5. Check if it works
5.1 Create a file index.php with content
Code: Select all
<?php phpinfo(); ?>

5.2 Navigate to localhost with your browser
alket
 
Posts: 1
Joined: Sep 18th, '15, 23:12

Return to The magician suggests...

Who is online

Users browsing this forum: No registered users and 1 guest

cron