Ngnix Conf to Apache Conf
I am trying to install node and react app inside cpanel. As i tried to manage and host the app and now, the app developer gave me nginx conf and unfortunately, he has no experience with apache and cpanel. But i want to run this inside our cpanel. As i tried with different stackoverflow and our forum questions. nothing helped to fix it. Here is the nginx conf
And i tried several links to get it working. Here are some. Nothing helped me. Either i am facing CORS error or peerjs handshake failure error. Error
and second error
I am helpless in this situation.
upstream apiUpstream {
# 1. Set your port here
# If you didn't change it from .env, you can
# ignore it and keep the default port 8080
server 127.0.0.1:8080;
keepalive 64;
}
server {
listen 80;
listen 443 ssl;
# 2. Set your API domainname here
server_name yourdomain.com;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://apiUpstream/;
proxy_redirect off;
proxy_read_timeout 240s;
}
# 3. SSL certificate set below
# Here is added a sample certificate format of letsencrypt
# You are free to remove it and configure yours here
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}And i tried several links to get it working. Here are some. Nothing helped me. Either i am facing CORS error or peerjs handshake failure error. Error
Access to XMLHttpRequest at 'https://api.example.com/host/signIn' from origin 'https://example.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.and second error
WebSocket connection to 'wss://api.tamilpos.com/peer/peerjs?key=peerjs&id=m3Kfglhpy3t&token=ekdxdw5hcpl' failed: Error during WebSocket handshake: 'Connection' header is missing
I am helpless in this situation.
-
Hello dude, Thank you for the prompt response. Actually i am feeling very comfortable with apache, i dont want to change it. I want to apply the similar configuration from nginx to apache. As i tried to apply the above told changes. But i cant make it work with that. Help me to convert the configuration from nginx to apache. 0 -
You can use Nginx server and apply the same configuration using cPanel's Nginx setup which is currently experimental or a third party nginx plugin 0 -
@kvvaradha - If you're going to be adjusting and customizing Apache on a cPanel system, you'll want to read the following documentation pages to make sure your work is compatible with the system: so that might be helpful as well. Can you look those over and see if that gets you pointed in the right direction? 0
Please sign in to leave a comment.
Comments
4 comments