DEV Community

Le Pulgué
Le Pulgué

Posted on

Problem deploying my page in production

I have 2 pages, each on a different server, but one of them does not work.
I started by using the production command ng build --prod --aot=true. After this I ran nginx.exe. With this in theory the frontend should be working.
When entering IP 127.0.0.1 on the server, the page appears but without the backend since the backend points to ljeans.mx.
For the backend I run pm2 start index.js -i 4. Once the command has been executed, if I go to https://www.ljeans.mx:3300/api/productos it works and gives me the result. So my problem is on the front but I can't find the problem. The issue here is that when I got to this job I realized that the domain is in IONOS and it points to the hostgator servers and in hostgator I have the redirection to my server.
this is my nginx.cong
`

user nobody;

worker_processes 1;

error_log logs/error.log;

error_log logs/error.log notice;

error_log logs/error.log info;

pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types application/javascript application/rss+xml application/vnd.ms-fontobject application/x-font application/x-font-opentype application/x-font-otf application/x-font-truetype application/x-font-ttf application/x-javascript application/xhtml+xml application/xml font/opentype font/otf font/ttf image/svg+xml image/x-icon text/css text/javascript text/plain text/xml;

server {

    listen       4300;
    server_name  localhost;

    return 301 https://$host$request_uri;


}



# HTTPS server
#
server {
    listen       443;
    server_name  localhostHttps;

    ssl on;
    ssl_certificate      "C:\SourceFiles\Tienda_lvale\web_lvale\certificado.cer";
    ssl_certificate_key  "C:\SourceFiles\Tienda_lvale\web_lvale\certificado.key";


    location / {
        root   "C:\SourceFiles\Tienda_lvale\web_lvale\dist";
        try_files $uri $uri/ /index.html;

    }

    location /imagenes {
        alias "C:/Recursos/";
        autoindex on;
    }
}
Enter fullscreen mode Exit fullscreen mode

}
`

Image description
Image description
Image description
Image description

Top comments (0)