R
R
Ruslan Absalyamov2018-08-18 12:05:20
Nginx
Ruslan Absalyamov, 2018-08-18 12:05:20

How can I connect two sites in the same domain?

I tried to make such a config, that is, the initial page is a landing page, and under admin there is already laravel with a frontend and a backend. It comes as a separate application independent of the landing, well, maybe a little, only the record from the database may depend, but there is only a record of one request.
I made this config /etc/nginx/sites-available/latina

server {
  listen 80;
  root /home/ruslan/Разработка/latina;
  index index.html index.htm index.php;
  
  server_name latina.site www.latina.site;

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


  location /admin {
    root	/home/ruslan/Разработка/latina/admin/public;
    index	index.html index.htm index.php;
    try_files $uri $uri/ /index.php?$query_string;
  }

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

THAT is the landing, everything works great, but the directory latina.site/admin 404 error
appears In /etc/nginx/nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
  worker_connections 4096;
  multi_accept on;
}

http {

  ##
  # Basic Settings
  ##

  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 65;
  client_max_body_size 100M;
  types_hash_max_size 2048;

   server_names_hash_bucket_size 64;

  include /etc/nginx/mime.types;
  default_type application/octet-stream;

  ##
  # SSL Settings
  ##

  ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
  ssl_prefer_server_ciphers on;

  ##
  # Logging Settings
  ##

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

  ##
  # Gzip Settings
  ##

  gzip on;
  gzip_disable "msie6";

  gzip_vary on;
  gzip_proxied any;
  gzip_comp_level 6;
  gzip_buffers 16 8k;
  gzip_http_version 1.1;
  gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;
}

There are no syntax errors
[email protected]:~$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

and nginx restarts everything is fine
. What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TyzhSysAdmin, 2018-08-18
@POS_troi

He culturally tells you that 404, there is no requested file, if you look at the LOGS! you will see that it does not find anything from the specified by you.
Since you specified the root directory
In which none of the above is present.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question