Answer the question
In order to leave comments, you need to log in
How to properly connect CMS to nginx?
Hello. Ran a nuxtjs app on a rented vps.
The nginx configuration now looks like this:
server {
listen 55.55.55.555:443 ssl;
server_name test.ru www.test.ru;
ssl_certificate /home/admin/conf/web/ssl.test.ru.pem;
ssl_certificate_key /home/admin/conf/web/ssl.test.ru.key;
error_log /var/log/apache2/domains/test.ru.error.log error;
location / {
proxy_pass http://localhost:3000;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/test.ru/public_html;
access_log /var/log/apache2/domains/test.ru.log combined;
access_log /var/log/apache2/domains/test.ru.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/test.ru/document_errors/;
}
location /news/ {
root /home/admin/web/test.ru/public_html/data/;
index index.php index.html index.htm;
}
location @fallback {
proxy_pass http://localhost:3000;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
disable_symlinks if_not_owner from=/home/admin/web/test.ru/public_html;
include /home/admin/conf/web/snginx.test.ru.conf*;
}
Answer the question
In order to leave comments, you need to log in
1) First, define 2 locations - @php {...}
and @nuxt {...}
(for example)
2) Next, decide what the document_root of the application should be and write it down (you can specify it for each location)
3) Next, specify through try_files for the location for example / api / look at nuxt and for / look at php
profit
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question