amux
@amux
alp.ac

Как настроить LEMP (Nginx & php7 & mySql) на Ubuntu 16.04?

Установил на чистый сервер LEMP по инструкции:
https://www.digitalocean.com/community/tutorials/l...

Перенёс с sepverpilot ( Другого сервера ) Файлы Kirby CMS
pg.site.com <- Вот что получилось, все мои попытки конфигурировать NGINX не увенчались успехом.

Сейчас у меня такие настройки:
server {
    listen 80;
    listen [::]:80;

    root /var/www/pg.site.com/public;
    index index.php index.html index.htm;

    server_name pg.site.com www.pg.site.com;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        # include snippets/fastcgi-php.conf;
        # fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}


Объясните пожалуйста как все настроить?

Upd:
Решил всё в итоге так:
Для кирби настроил nginx
server {
    listen 80;
    listen [::]:80;

    root /var/www/pg.whata.ninja/public;
    index index.php index.html index.htm;

    server_name pg.site.com www.pg.site.com;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    #location / {
    #    try_files $uri $uri/ =404;
    #}

    location ~ /\.ht {
        deny all;
    }

	 	##############################
	  ## Kirby configuration
	  ##############################

	  # Don't hint these as folders
		rewrite ^/(content|site|kirby)$ /error last;

		# block content
		rewrite ^/content/(.*).(txt|md|mdown)$ /error last;

		# block all files in the site and kirby folder from being accessed directly
		rewrite ^/(site|kirby)/(.*)$ /error last;

		# removes trailing slashes (prevents SEO duplicate content issues)
		if (!-d $request_filename) {
		    rewrite ^/(.+)/$ /$1 permanent;
		}

		# panel links
		location ~ /panel {
		    try_files $uri $uri/ /panel/index.php?$uri&$args;
		}

		# site links
		location ~ / {
		    try_files $uri $uri/ /index.php?$uri&$args;
		}

		# Prevent clients from accessing hidden files (starting with a dot)
		# This is particularly important if you store .htpasswd files in the site hierarchy
		location ~ (?:^|/)\. {
		    deny all;
		}

		# Prevent clients from accessing to backup/config/source files
		location ~ (?:\.(?:bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$ {
		    deny all;
		}

	  ##############################
	  ## End Kirby CMS configuration
	  ##############################
}


В php.ini прописал
short_open_tag = On

И установил php7.0-mbstring
  • Вопрос задан
  • 584 просмотра
Решения вопроса 1
sayber
@sayber Куратор тега PHP
Да, я программирую на PHP и еще асинхронно!
1) Что всегда делает человек из IT сферы - читает логи. /var/log/nginx/error.log
2) Смотрит их и выясняет причину
...

А еще сравнивает, конфиг из приведенной доки с своим. И если у него не -100 зрение, то видит что то лишнее.
43758364289f48ef94f8a4dd198e1306.png

А еще он почему то теги пишет <? вместо <?php.
Хотя если он разрешил написание коротких тегов, то ок.
Ответ написан
Пригласить эксперта
Ответы на вопрос 1
SimBioT19
@SimBioT19
{{ user.about }}
sudo apt-get update

sudo apt-get upgrade

sudo apt-get dist-upgrade


sudo apt-get install python-software-properties
sudo add-apt-repository ppa:nginx/stable
sudo apt-get install nginx

sudo apt-get install php

sudo apt install mysql-server mysql-client

sudo apt-get install phpmyadmin php-mbstring php-gettext

sudo apt-get install php7.0-sqlite
sudo phpenmod mcrypt mbstring

sudo apt-get install php-curl cron

sudo mkdir /etc/nginx/sites-available && sudo mkdir /etc/nginx/sites-enabled


Дальше настройка nginx конфигов. Может вечером свои напишу, если требуется
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы