E
E
Enkil2014-06-04 08:14:43
PHP
Enkil, 2014-06-04 08:14:43

Scripts not connecting in Yii/Nginx/Php-fpm?

Good afternoon!
I ask you to help me solve the following problem
A Yii site has been developed
on the developers' machines and everything works correctly on the test server.
The project has been accepted and the time has come to deploy a combat server for the client and the site on it
VPS from digitialocean.com is used
CentOS 6.4 x64
php 5.5
php-fpm
nginx 1.7.1 build from source (due to the need to connect some third-party modules, for example goggle pagespeed)
Problem in the following:
js / css scripts are not connected on the production server, they are displayed as text on the page
while php works (phpinfo, basic Yii application - everything is ok). if you enter the wrong URL, then the 404 page opens correctly, all scripts work on it.
The logs are clean, Yii debug is enabled, logging level php = E_ALL
If you run the web server built into php, then everything is the same, and there are no errors in the console.
The rights to the directories are set (and to the path to the webroot for the user of the nginx process and to assets and protected/runtime).
/yii/requirements/index.php - also everything is OK,
I tried green php 5.3.3 - the situation does not change
Virtual host configuration

upstream php5-fpm { server unix:/var/run/php5-fpm.sock; }

server {
    listen 80.240.136.57:80;
    server_name  домен;
    root /home/тут имя юзера/www/public_html;
    index index.php;

    access_log /var/log/nginx/домен.access.log;
    error_log /var/log/nginx/домен.error.log;

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }

    location ~ /(protected|framework|nbproject) {
        deny all;
        access_log off;
        log_not_found off;
    }

    location ~ /themes/\w+/views {
        deny all;
        access_log off;
        log_not_found off;
    }

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


 location ~* \.css|\.js|\.jpg|\.jpeg|\.png|\.gif|\.swf|\.svg|\.tiff|\.pdf$ {
    try_files $uri =404;
  }    

    location ~ \.php$ {

        try_files $uri =404;

        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;
        fastcgi_param  PATH_INFO        $fastcgi_path_info;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_pass php5-fpm;
    }
}

fpm pool config
[домен]

    listen = /var/run/php5-fpm.sock
    listen.mode = 0666
    user = имя юзера
    group = имя группы юзера
    chdir = /home/имя юзера/www

    php_admin_value[upload_tmp_dir] = /home/имя юзера/www/tmp
    php_admin_value[upload_max_filesize] = 100M
    php_admin_value[post_max_size] = 100M
    php_admin_value[open_basedir] = /home/имя юзера/www/public_html
    php_admin_value[disable_functions] = exec,passthru,shell_exec,system,proc_open,popen,curl_multi_exec,parse_ini_file,show_source
    php_admin_value[cgi.fix_pathinfo] = 0
    php_admin_value[date.timezone] = Europe/Moscow
    php_admin_value[session.save_path] = /home/имя юзера/www/tmp

    pm = dynamic
    pm.max_children = 10
    pm.start_servers = 2
    pm.min_spare_servers = 2
    pm.max_spare_servers = 4

the site itself
80.240.136.57 - here is the site
80.240.136.57:6060 - here is the site launched on the PHP built-in web server 80.240.136.57:81
- here is the basic Yii application
delivery of another project, I turn to the community for advice
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Zubkov, 2014-06-04
@Enkil

Try declaring a section with PHP code <?php, you have it just <?

I
Igor, 2014-06-04
@merryjane

is there a file connection with mime.types in nginx.conf?
The mime.types file itself should have a mapping for these extensions:

text/css				css;
application/x-javascript		js;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question