nginx始终在每个路径中提供根index.html

时间:2018-08-10 11:00:40

标签: nginx

我目前有以下代码。我想知道即使我转到http://localhost/dog之类的其他页面,是否仍然可以提供此根服务。我下面的命令的问题是它将返回404

server {
    listen 80;
    server_name         localhost;

    location / {
        root /usr/src/app/angularjs/dist;
    }
}

1 个答案:

答案 0 :(得分:3)

有可能。将def send_email(subject, message, receivers): msg = email.message.Message() sender = "mydomain.com" msg["Subject"] = subject msg["From"] = sender msg["To"] = ", ".join(receivers) msg.add_header('Content-Type', 'text') msg.set_payload(message) smtpObj = smtplib.SMTP("thats.not.cheddar") smtpObj.sendmail(msg["From"], msg["To"], msg.as_string()) smtpObj.quit() 指令添加到您的try_files块中,这将告诉Nginx使用您的location加载所有无法与文件系统路径匹配的请求:

index.html