Dotnet Console App
Documentation for Deployment Of Backend WebSocket
These all steps are followed on Azure Virtual Machine.
Command - “SocketIOSharp-Example Server.exe†and make sure it is running.
Run the powershell by administrative
Start-Process "C:\Users\examwork\Desktop\finaal call\new1\exam_works_roshan_darnal\backend\ew_prototype_examwork - Copy\SocketIOSharp-Example Server\bin\Debug\SocketIOSharp-Example Server.exe" -WindowStyle Hidden
Now from this command project will run in backend
To check our application is running we need to see port number by the command netstat -aon in power shell
As we see that port 9001 is running in background
windows defender firewall > advanced setting > inbound rule
To allow connection we need to define port and allow the connections
Log in azure portal > go to your virtual machine > networking > add inbound rule
Go to connection on left side on iss console, click on sites and stop iss
and check the status
http://nginx.org/en/docs/windows.html
Path - C:\Users\examwork\Downloads\nginx-1.22.0\nginx-1.22.0\conf
now change the nginx.config file with this code as per requirements
Nginx Configuration Is Here
******************************************************************************************
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name examwork.workshopcloud.shop;
location / {
proxy_pass http://127.0.0.1:9001;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
upstream websocket {
server 20.219.124.44:9001;
}
server {
listen 443 ssl;
server_name examwork.workshopcloud.shop;
ssl_certificate C:\Certbot\live\examwork.workshopcloud.shop\fullchain.pem;
ssl_certificate_key C:\Certbot\live\examwork.workshopcloud.shop\privkey.pem;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}
These changes are for web socket securing with ssl
A. Server name - examwork.workshopcloud.shop
B. Proxy Pass - 9001
C. Ssl - Certbot Application Download For Windows
ssl_certificate C:\Certbot\live\examwork.workshopcloud.shop\fullchain.pem;
Ssl_certificate_key C:\Certbot\live\examwork.workshopcloud.shop\privkey.pem;
D. apply proxy_pass to web socket
Some Nginx Imp Commands
./nginx -t
./nginx -s reload
./nginx stop
7. Restart nginx with powershell
Run the powershell with administrative
These are the commands for nginx
nginx -s start to start
nginx -s stop | fast shutdown |
nginx -s quit | graceful shutdown |
nginx -s reload
nginx -t | modifying configuration, launching new worker processes with a new configuration, and graceful shutdown of old worker processes.
To check right configuration in nginx file |
nginx -s reopen | re-opening log files |
wss://examwork.workshopcloud.shop/