I want to deploy to heroku nginx as a reverse proxy in front of my Go application.
I made a config file for nginx, but its samples presented here https://github.com/heroku/heroku-buildpack-nginx do not give an understanding of which port to specify in the proxy_pass directive to redirect to my application. These examples use unix socket listening instead of http.
upstream app_server {
server unix: /tmp/nginx.socket fail_timeout = 0;
}
But my application is running over http.
In addition, heroku uses random ports, which the application must retrieve from the PORT environment variable. However, now I have set this variable in the config for nginx. What port should my application run on now? If you specify your own port, this will not work, since heroku will say that the port is already busy.
I am completely discouraged by the difficulty of deploying a simple environment for my heroku application. None of the heroku instructions give a comprehensive understanding of how this can be done.
Please guide me on the right path.
P.S. For a couple of days of searching for an answer, I found only a lot of questions similar to mine and not a single answer.
Update.
I did as in this post Springboot application with nginx as proxy deploy on Heroku
But the author did not explain what she set in the APP_PORT variable. I set it to 3001 and got the same thing as here:
Nginx and Heroku. Serving Static Files
Related
My organization blocks ngrok, so every time I run the Shopify serve command, it fails with a connection error.
So is there any way to just start the Shopify local server? that way I can use cloudfared to tunnel the local server to a subdomain.
When I search on google I found no answer to this question.
I had success running the server without the ngrok.
Here are my steps:
Prepare a cloud server, install Nginx.
config domain settings, and forward the request to your local port.
If you are using a router, only router has a public IP, so you need to forward the request to your pc. You could config it in the router.
then you need to update .env file, update host value
Go partner.shopify.com, app settings. put your URL to the whitelist.
use npm run dev to start your project.
I also set HTTPS in nginx. Due to ngrok server is far away from my location. so after using this way. the starting time is much faster.
Start the server by
npm run dev
instead of,
shopify app serve
I have a .jar file that listens for requests and streams music (lavalink). When I run it locally on my own computer, I can make requests to it and everything works fine. However, when I move it to be hosted on heroku, trying to send a request to the app just results in nothing happening.
I am using "https://my-app-name.herokuapp.com" as the hostname to connect to, and the port I am using is the one that shows up in the logs:
Starting process with command java -Dserver.port=27955 -jar Lavalink.jar
^this one
Am I doing something wrong? Can Heroku maybe not find the java app? Do I need to provide a different hostname or port?
Turns out that Heroku always listens on port 80 for external requests and then routes the traffic to the port that shows up in the logs. Rewriting the config file (that the java app uses) during build to use the port that shows up in the logs seems to work.
I'm an iOS developer primarily. In building my current app, I needed a server that would have a REST API with a couple of GET requests. I spent a little time learning Ruby, and landed on using Sinatra, a simple web framework. I can run my server script, and access it from a browser at localhost:4567, with a request then being localhost:4567/hello, as an example.
Here's where I feel out of my depth. I setup an Ubuntu droplet at DigitalOcean, and felt my way around to setting up all necessary tools via command line, until I could again run my server, now on this droplet.
The problem then is that I couldn't then access my server via droplet.ip.address:4567, and a bit of research lead me to discovering I need Passenger and an Apache HTTP Server to be setup, and not with simple instructions.
I'm way in over my head here, and I don't feel comfortable. There must be a better way for me to take my small group of ruby files and run this on a server, than me doing this. But I have no idea what I'm doing.
Any help or advice would be greatly appreciated.
bit of research lead me to discovering I need Passenger and an Apache HTTP Server to be setup, and not with simple instructions.
Ignore that for now. Take baby steps first. You should be able to run your Sinatra app from the command line on the DigitalOcean droplet, and then access it via droplet.ip.address:4567. If that doesn't work something very fundamental is wrong.
When you start your app, you will see what address and port the app is listening on. Make sure it's 0.0.0.0 and 4567. If it's 127.0.0.1 or localhost that means it will only service requests originating from the same machine
After you get this working, next step is to make your Sinatra app into a service. Essentially this means the app runs in the background, and auto-starts when the system reboots. Look into Supervisor which is very simple configuration to get this running.
Later you can install Apache or Nginx to put in front of your Sinatra app. These are proxies which simply forward requests from port 80 (default HTTP port) to your sinatra app, but can do additional things such as add SSL support, load balancing, custom error pages etc. - all of which you do not need right now.
This is a bit of a tricky situation. I'm testing deployment of a Laravel application which I've recently containerised. I've made a container based on php, which runs Apache inside itself to serve the application. If I simply run this container, bound to port 5000, then link_to('/login') correctly generates a link pointing to localhost:5000/login.
However, now I'm testing an actual deployment scenario, where this container is running behind an nginx load balancer. I've set up a VM using Vagrant, which is running two containers: one for the nginx load balancer, and one for the Apache/Laravel application. I access the VM's port 80 on my host's port 7000.
In this situation, link_to('/login') now generates links pointing to localhost/login. Where did the port go missing? It should link to localhost:7000/login, because that's the port I'm accessing the page on.
How can I debug this? I've tried looking into the implementation of link_to, but I suspect the problem is elsewhere.
EDIT
I've just discovered that in addition, if I serve the site over HTTPS (terminated at nginx; Apache still does everything over HTTP), this is also stripped from links created by link_to. Instead of https://localhost:7443/login, the link looks like localhost/login.
The solution is to use something like fideloper/proxy to properly handle the proxy headers added by Nginx. I thought I had done this, but I'd forgotten to add the facade to app/config/app.php.
I have gitlab running behind a proxy, gitlab itself running on port 3000 not accessible from outside.
Mail notifications generated by gitlab always contain URLs with port 3000 in them, so where can I configure gitlab to generate links accessible from outside?
I already found
gitlab email setup
but I do not have email:host: or anything like that in my gitlab.yml
I'm running gitlab 5.2.0 right now.
EDIT: I would also appreciate any link to some info about the config options in gitlab.yml...
The setting is indeed in gitlab/config/gitlab.yml, it just isn't that clear anymore (config names and comments changed in gitlab 5.0 I think).
The section ## Web Server Settings is actually used to generate the links in emails. The only settings referring to emails are email_from: and support_email: but host:, port: and https: are also used for links in emails.
The actual IP and port settings can be found in puma.rb config file which is why I was confident enough to just tinker around with the gitlab.yml settings and it worked.
Solution for my problem: just comment the production:gitlab:port: setting or change it to your external port.