我正在尝试通过nginx
路径将uri
服务器配置为具有不同的工作目录。
这是我的配置文件
server {
server_name abc.com
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
access_log /var/www/abc.com/log/access.log;
error_log /var/www/abc.com/log/error.log;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm;
#location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
#}
location /api {
root /var/www/abc.com/html/public;
}
location / {
root /var/www/cabinet.client;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
#fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
# managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/abc.com-0001/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/abc.com-0001/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
因此,我有2个存储库客户端(Javascript - Vue JS
)和服务器端(PHP - Laravel Api
)。
因此,当用户请求页面时,我要呈现html
文件
但是,当用户向服务器发送请求时(api的路径以api
开头),我想删除我的php
代码。
尝试访问abc.com
时,我总是空白页。
我做错了什么?