I am building an application using Node JS, and Angular JS in Windows 10. I want to integrate Nginx with it. I am new to it. I have read several articles on it but get confused how to configure it.
I have run the app in localhost:3000/
i.e. Express default port. Should I on the Node JS server using nodemon server.js
?
Some of the lines of my configuration of Nginx like below,
file: C:\nginx-1.13.0\conf\nginx.conf
#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;
server {
listen 80;
server_name localhost;
root C:/Users/asau/Documents/archlb/src/public;
index index.html index.htm;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
# C:/Users/asau/Documents/archlb/src/public;
# index index.html index.htm;
}
location /images/ {
}
location /js/ {
# root C:/Users/asau/Documents/archlb/src/public/js
}
When I use localhost
the index.html
opens in the browser but it can't access the REST APIs which are calling from Angular JS. All Angular JS files are included in index.html
. And it shows can not get localhost/getversion (404)
error in Google Chrome Developer tools.
But, if I use localhost:3000/
everything works fine. What configuration should I use?
via Anijit
No comments:
Post a Comment