S
S
Silverviql2018-07-22 15:25:45
Nginx
Silverviql, 2018-07-22 15:25:45

Text is displayed instead of yii2 website page on ubuntu 16.04, how to fix?

Based on this video, I installed the yii2 site https://www.youtube.com/watch?v=khpMJiZDvkE.
If in the nginx settings root /var/www/yii/crm_2/3/backend/web; then the standard yii page will come out.
5b5477739fc0f165604289.png
If you refer to the site where the main project is root /var/www/yii/crm_2.3/frontend/web;
Then the following comes out. 5b5477bbc49d3249526739.png
What could be the problem?
nginx settings

Настраиваем конфигурацию nginx:
sudo nano /etc/nginx/sites-available/default

Меняем содержимое на:
!!!Меняем путь в root


server{
 charset utf-8;
 client_max_body_size 128M;

 listen 80;

 server_name backend.dev;
 #root /var/www/yii/project/backend/web;
 root /var/www/yii/crm_2.3/frontend/web;
 #root /var/www/yii/crm_2.3/backend/web;
 index index.php;

 access_log /var/log/nginx/access.log;
 error_log /var/log/nginx/error.log;

 location / {
 try_files $uri $uri/ /index.php?$args;
}

 include /etc/nginx/php.conf;

 location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
 access_log off;
 log_not_found off;
 expires off;
}

 location ~ /\.(ht|svn|git) {
 access_log off;
 log_not_found off;
 deny all;
 }
}


Создаем файл /etc/nginx/php.conf:
sudo touch /etc/nginx/php.conf

Добавляем в него содержимое:

sudo nano/etc/nginx/php.conf


location ~ \.php$ {
 include fastcgi_params;
 #fastcgi_pass 127.0.0.1:9000;
 fastcgi_pass unix:/run/php/php7.0-fpm.sock;
 #fastcgi_pass unix:/run/php5-fpm.sock;
 fastcgi_read_timeout 3000;
 

 fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
 fastcgi_buffers 16 16k;
 fastcgi_buffer_size 32k;
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oughtrock, 2019-03-20
@Oughtrock

It was possible to address the same problem, without a complete replacement of the configs. I had a problem with the "short_open_tag" parameter. When it's "off", the code after the "<?" is not treated as php and is not interpreted because it is not "<?php". And just in the config there was "<?" and everything fell apart)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question