M
M
Mikhail Smirnov2017-08-30 21:23:24
Nginx
Mikhail Smirnov, 2017-08-30 21:23:24

How to set up nginx under yii2 advanced on the same domain?

Tell me how to configure the nginx config for yii2 advanced
there is a managers.local domain on which the frontend application should work, and the backend should work at managers.local/manager

server {
    listen       80;
        ssi on;
        gzip on;
        gzip_comp_level 7;
        gzip_types application/x-javascript application/javascript text/css;
    charset utf-8;
    client_max_body_size 128M;

    server_name managers.local;
    root        /public_html/frontend/web;
    index       index.php;
    
    location / {
      try_files $uri $uri/ /index.php$is_args$args;
    }

    # deny accessing php files for the /assets directory
    location ~ ^/assets/.*\.php$ {
      deny all;
    }

    location ~ \.php$ {
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_pass 127.0.0.1:9000;
      #fastcgi_pass unix:/var/run/php5-fpm.sock;
      try_files $uri =404;
    }

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

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2017-08-30
@BorisKorobkov

location /manager {
...
}

location / {
...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question