-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
116 lines (81 loc) · 3.01 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
Coin Listener Server
This project collects information about various coins and serves it through an API. It also provides configuration for Nginx to handle HTTP and HTTPS requests.
Prerequisites
Before running the server and Nginx, ensure you have the following installed:
Node.js
Nginx
Running the Coin Listener Server
To start the server that gathers information about coins, follow these steps:
Navigate to the server directory:
bash
cd ./server
Start the server using Node.js:
css
node main
Running Nginx with Different Configurations
To run Nginx with the provided configurations, use one of the following commands, depending on whether you want to use HTTP or HTTPS. Make sure to replace the paths with your actual configuration file paths.
For HTTP
bash
sudo nginx -c /home/savely/Documents/projects/services/coins_listener/http_nginx.conf
For HTTPS
Before running Nginx with HTTPS, you need to obtain an SSL certificate and configure Nginx accordingly. Use the following command:
bash
sudo nginx -c /home/savely/Documents/projects/services/coins_listener/https_nginx.conf
Nginx Configuration
Here is an example configuration for Nginx (http_nginx.conf and https_nginx.conf):
bash
worker_processes auto;
events {
worker_connections 1024;
}
http {
default_type application/octet-stream;
types {
text/css css;
application/javascript js;
text/html html htm;
}
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /home/savely/Documents/projects/services/coins_listener/client/dist;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /backend {
rewrite ^/backend/(.*) /$1 break;
proxy_pass http://localhost:3030;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 443 ssl;
server_name localhost;
ssl_certificate ./ssl/server.crt;
ssl_certificate_key ./ssl/server.key;
location / {
root /home/savely/Documents/projects/services/coins_listener/client/dist;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /backend {
rewrite ^/backend/(.*) /$1 break;
proxy_pass http://localhost:3030;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}
Conclusion
Follow the steps above to run the Coin Listener server and configure Nginx for your application. Ensure that all paths are correctly set according to your directory structure.
For any further assistance or issues, feel free to reach out!