Кажется, это нормальный вопрос, и я много проверял. Тем не менее я получаю ту же ошибку после применения возможных проверок.
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name abc.com www.abc.com;
ssl on;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root /opt/workspace/myapp/;
try_files $uri $uri/ /index.html;
#try_files $uri$args $uri$args/ /index.html;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass "http://XXX.XXX.XXX.XXX:4200";
}
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
Я следовал этому https://angular.io/guide/deployment для nginx, используя try_files, но безрезультатно. Возможно, я делаю какую-то ошибку в конфигурации.
* ПРИМЕЧАНИЕ. Я запускаю угловое приложение, используя
app_dist_folder / http-server . -p 4200