所以我使用了一个数字海洋服务器,我起诉了LEMP的构建。
当我导航到/var/www/html目录时,我会看到构建'index.html‘和'index.php’两个标准文件。
现在我的问题是,我的Web的结构使得"index.html“文件位于另一个子目录"dist”下。(/var/www/html/dist/)
如何配置Nginx以显示此文件?
更新:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
servername ***.**.**.**;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;发布于 2016-11-14 13:27:56
在配置中更改这一行
root /var/www/html;把这个放进去
root /var/www/html/dist;编辑:
如果使用基于Debian的服务器(例如Ubuntu),请在控制台上执行sudo service nginx reload。如果不起作用,请尝试sudo service nginx restart
https://stackoverflow.com/questions/40589120
复制相似问题