I am running a remote server on EC2 with rstudio and was looking to set up a reverse proxy as indicated in the documentation here using nginx
When I start or restart nginx i get the error message shown below. Obviously, nothing else is running on port 80. I dont have apache or any other webserver installed.
ubuntu@ip-10-4-xxx-xxx:~$ sudo fuser -k 80/tcp ; sudo /etc/init.d/nginx restart
Restarting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
nginx.
the module I added to ngnix.conf is the recommended snippet:
http {
server {
listen 80;
location / {
proxy_pass http://localhost:8787;
proxy_redirect http://localhost:8787/ $scheme://$host/;
}
}
}
I did try using 8080 instead of 80 and ngnix starts fine, but doesn’t connect to rstudio. rstudio is meanwhile available on 8787. It feels like i am missing something really simple here. Help please!!
Aww snap.. Just got it after typing up the question in full. The conf file had an include that had to be commented out
changed to
Works perfectly now. Somebody @rstudio please update the documentation in the link I showed above
UPDATE: Please see the response from @DirkEddelbuettel in his comment below. The right way would be to add this code snippet in an appropriate file in the “sites-enabled” directory.