I want to set up a reverse proxy to access kibana using a username and a password, so I followed this tutorial.
When I use the URL http://elastic.local to access kibana the timeout occurs and nothing happen.
But when I use 127.0.0.1:80 it accesses kibana without prompting any credentials.
I want to access kibana using for example http://elastic.local but can't make it work, I already googled a lot of solutions and many Nginx configuration files but none of them seems to work.
This is my configuration file named 'default' and located in etc/nginx/site-available and The symbolic link is already created and located under etc/nginx/site-enabled :
server {
listen 80;
server_name elastic.local;
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/htpasswd.users;
location / {
proxy_pass http://localhost:5601;
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;
}
}
PS : I already have ELK stack in my Ubuntu vm, and it's working fine and i can access kibana using
http://127.0.0.1:5601
I managed to fix the problem what i did :
add a mapping between elastic.local and 127.0.0.1 in etc/hosts like this :
127.0.0.1 elastic.local
then restarting nginx server using :
sudo systemctl reload nginx.service
Related
I am new Nginx. Currently, I configured my domain to be served by Nginx on the default configuration as follows and it is working.
sudo nano /etc/nginx/sites-available/default
Default configuration:
server {
listen 80;
server_name uidcenterkl.my *.uidcenterkl.my;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
However, I learnt that I need to create domain specific directive such as mywebiste.com.conf as follows:
sudo nano /etc/nginx/sites-available/mywebiste.com.conf
Question:
What should I choose, default or mywesbite.com.conf to serve a single domain? And if I went with mywebsite.com.conf, how to deactivate default configuration so that it does not cause conflict.
You may actually not need to set up domain specific directive to serve a single domain. default directive should work fine for you.
And if you choose to use mywesbite.com.conf, all you need to do to disable default is to delete it from inside sites-enabled directory
After creating your mywesbite.com.conf feel free to delete the default.conf by running this command from your sites-enabled dirctory:
sudo rm ../sites-enabled/default.conf
Don't forget to restart your nginx after that command
systemctl restart nginx
I have a dash plotly running on a VM with ip address 192.168.8.3 on port 5050. Locally, I can access the dashboard using the url http://192.168.8.3:5050.
Now I am trying to enable access via Nginx on http://myserver.com/dashboard/devs. However, when i try access it, in the browser console there is some files not found:
GET http://myserver.com/assets/header.css?m=1597279663.0
GET http://myserver.com/assets/typography.css?m=1597279663.0
This is my nginx configuration:
server {
server_name myserver.com;
location /dashboard/devs {
rewrite ^/(dashboard/devs)/(.*) /$2 break;
proxy_pass http://192.168.8.3:5050;
proxy_set_header X-Real_IP $remote_addr
...
proxy_set_header Host $http_host;
proxy_redirect off;
}
}
Finally it was resolved using flask to redirect "/" requests to "/dashboard/devs/". The nginx configuration was left untouched.
Well, here we go.
I have an instance in Azure with ubuntu and I'm trying to access an web application out of this machine (Not LocalHost).
First I've installed all dotnet things to make a test application and runned
dotnet new mvc
I check inside Azure machine localhost:5000 and this app test work well.
Then I installed nginx to access my application remotelly. When I access the public IP I can see a page of nginx.
nginx Page
I've try to config thousand times to when I access the public IP the nginx redirect to my web app running in Azure Localhost.
One configuration I've try was
/etc/nginx/sites-enabled
server {
listen 80;
location / {
proxy_pass http://localhost:5000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Any Idea to make this works?
Sry for bad english
You have missed server_name parameter.
And if that's the only one config in config dir, then also add default_server option to listen directive, like this:
server {
listen 80 default_server;
server_name my.domain.com;
location / {
proxy_pass http://localhost:5000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Change my.domain.com to appropriate FQDN of your Azure instance, so that you can make requests not only by entering IP address in browser, but also with a host name.
And make sure that you have included that config in nginx.conf file, like:
include /etc/nginx/sites-enabled/*;
Hope it will help you to figure out.
I own a website bought in Godaddy and I recently created a sub-domain "tools" for this website.
My final goal is that the url: http://tools.website.com redirects to my shiny dashboard hosted on my shiny server. For that I know I need to use nginx which I did but apparently not successfully.
I am using Linux and EC2 instance, my shiny dashboard runs on http://5.82.382.227:3838/myapp/ (example). After I created the subdomain, I noticed it also runs on:
http://tools.website.com:3838/myapp/
I followed instructions and updated the shiny.conf file with the following:
server {
listen 80;
listen [::]:80;
server_name tools.website.com;
location / {
proxy_pass http://5.82.382.227:3838;
# proxy_redirect http://localhost:3838/ $scheme://$host/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 20d;
proxy_buffering off;
}
}
I also figured out I had to add:
include /etc/nginx/sites-enabled/*
in the http of the nginx.conf file so I modified it by doing:
sudo nano /etc/nginx/nginx.conf
Finally, I ran:
sudo nginx -t
and get:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
and restrated nginx:
sudo systemctl restart nginx
But still does not work.
I'm trying to deploy a basic Phoenix app to a DigitalOcean server running ubuntu 14.04. I'm using exrm to generate the release. The release works when I test it on my local machine and on the server. I'm following the Phoenix guides on deployment. The thing that doesn't seem to work is the last part with the nginx server setup. For some reason I cant get it to load anyting but the default page. When I run the
nginx -t # command. It says everything is fine.
I've tried editing the /etc/nginx/sites-available files. Doesn't seem to do anything. I've tried restarting the nginx server with
sudo service nginx reload
sudo service nginx restart
But that doesn't seem to work either.
And this is the content of my /etc/nginx/sites-available/my_app.conf
upstream my_app {
server 127.0.0.1:4000;
}
server{
listen 80;
server_name www.example.com;
location / {
try_files $uri #proxy;
}
location #proxy {
include proxy_params;
proxy_redirect off;
proxy_pass http://my_app;
# The following two headers need to be set in order
# to keep the websocket connection open. Otherwise you'll see
# HTTP 400's being returned from websocket connections.
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
Update: Tried connecting directly via server_ip:port, and it worked. The url still doesnt display anything.
Solved: For some reason deleting this solves the problem.:
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
Solved: For some reason deleting this solves the problem.
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;