首页 > 解决方案 > 我的站点无法正常工作,甚至在站点可用默认值中添加了构建路径

问题描述

我在 AWS Ngnix 上添加了我的网站。我已经构建了一个应用程序并在 /etc/ngnix/sites-available/default 中添加了该路径,但是在访问 IP 地址后它说找不到 404。

我构建了一个应用程序并在站点可用/默认中提供了该路径

以下是我的网站的代码 - 可用/默认

GNU nano 2.9.3                                                                        /etc/nginx/sites-available/default                                                                                  

        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

#       root /var/www/html;
        root /var/www/sample/dist/sample;
        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri /index.html index.php;
        }

        # pass PHP scripts to FastCGI server
        #
        #location ~ \.php$ {
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php-fpm (or other unix sockets):
        #       fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}

标签: nginx

解决方案


推荐阅读