I am using NPM to configure my subdomains and redirect them to my containers.
My problem is that I cannot do the same with the main domain.
I am using nginx server with php for my site, after configuring a proxy host to test.example.com it is working flawlessly, but if I configure the same for example.com or www.example.com, I am not able to open my site.
I've uploaded my certificate to npm as a custom certificate and assigned it to the example.com proxy host, but it's not working.
If I open http://example.com I get the "Congratulations" page from NPM.
How can I make my site example.com working identical as test.example.com?
I've tried following in my nginx conf:
ssl on;
ssl_certificate /path;
ssl_certificate_key /path;
changing the server_name;
Related
I have a nginx server with domain name[www.sample.com] and IP adress [1.1.1.1].
Also I have an apache Server that contains WordPress with ip[2.2.2.2].
Nginx Configured to proxy_pass www.sample.com/app to 2.2.2.2/ap.
WordPress loads paths, but could not load Css Resource on wordpress wp-include
I have an NGINX webserver, which is serving multiple websites. For each website, I have a seperate nginx configuration file in the /etc/nginx/sites-available folder.
Now, I would like to have two domainnames (aaa.com and bbb.com) point to the same website. On the registrar side both domain names point to the IP address of my webserver.
On nginx, I have the following configuration:
server {
listen 443 ssl http2;
root /var/www/html/aaa.com/public_html;
index index.html index.php index.htm;
server_name aaa.com www.aaa.com bbb.com www.bbb.com;
<rest of the configuration
}
I can reach now www.aaa.com but accessing the website via bbb.com does not work.
Should I create a seperate config file (in sites-available) for bbb.com and point to the location of the website in /var/www/html and enable it in sites-enabled?
I am new to nginx and am trying to configure a reverse proxy to a Shiny Server (Open) that I have successfully implemented on an AWS Lightsail Instance. I am desperate at this point and would appreciate any advice. Here are the pertinent configuration arrangements.
Note that I have a purchased a custom domain from GoDaddy. Assume this is named mydomain.com.au. However, I have changed the name servers to point to Netlify as I deployed my website through the blogdown R package in Netlify.
Lightsail Instance Details
This has a Shiny Server installed and a static IP address assigned. Assume 123.45.67.89 from this point onwards. The firewall details are provided below:
Lightsail instance firewall details
I can successfully access the Shiny Server via http://123.45.67.89:3838 and associated Shiny apps I've deployed. I have a DNS Zone record added in order to link mydomain.com.au to my Shiny Server on the Lightsail instance - see details below:
Record Type: A
Subdomain: shiny.mydomain.com.au
Resolves to: 123.45.67.89 (i.e. static IP address)
Netlify details
I have a DNS record added in Netlify for mydomain.com.au which points to the Lightsail instance static IP address. Below are the details (I'm not sure whether I need a DNS record in Netlify and Lightsail though). Note this this is SSL/TLS certificate enabled and cannot be disabled (it will automatically revert to "https://" even when "http://" is specified).
Name: shiny.mydomain.com.au
TTL: 3600 seconds
Type: A
Value: 123.45.67.89
nginx details
Below are the relevant details of the /etc/nginx/sites-enabled/default file which I modified based on the instructions from this post. The $http_upgrade and $connection_upgrade is stored in the /etc/nginx/nginx.conf file. There is no SSL/TLS certificate from certbot added and I'm not sure whether this is an issue.
server {
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name shiny.mydomain.com.au;
# Reverse proxy to port 3838
location / {
proxy_pass http://localhost:3838/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 20d;
proxy_buffering off;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
}
The nginx configuration test appears to be successful:
sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
The following firewall profiles (from sudo ufw status) are set up - Nginx HTTP, OpenSSH, 3838 and 80. nginx is active and running too with no issues according to sudo service nginx status.
What works?
http://123.45.67.89:3838/ successfully opens the Shiny Server index page.
https://shiny.mydomain.com.au:3838/ successfully opens the Shiny Server index page.
Other information?
Visiting https://shiny.mydomain.com.au:3838 will automatically attempt https://123.45.67.89:443 which ultimately fails and times out. The redirection to 123.45.67.89 appears to work but it does not forward to the 3838 port. Firefox Network monitoring indicates that the Server is nginx.
What might be happening?
At this point (and I am very new to web administration), I think this might be an issue with Netlify forcing HTTPS which cannot be redirect to the Shiny Server port (HTTP?). However, visiting https://shiny.mydomain.com.au:3838 successfully redirects to the Shiny Server index page. I just can't understand why nginx isn't successfully forwarding to the 3838 port without specifying it in the URL based on the default configuration file.
What is the problem?
Loading shiny.mydomain.com.au does not successfully load the Shiny Server index page. It will eventually time out and no page is loaded ("The connection has timed out"). Checking the network monitoring information in Firefox indicates that tries to access 123.45.67.89 but not 123.45.67.89:3838 (i.e. the Shiny Server). It doesn't appear that it is redirecting at all according to the /etc/nginx/sites-enabled/default file.
I have tried changing localhost to 127.0.0.1 to no avail. I have tried following Dean Attali's post and another recent post on setting up Shiny Server too but still no success.
Can someone please help me out on how to get nginx as a reverse proxy to work?
I'm really running out of ideas here. Thanks.
I'm trying host a website with multiple subdomains (created with Cloudflare, which also provides SSL) hosted on DigitalOcean with Nginx serving as a reverse proxy.
My Cloudflare Configs
DNS setup:
Type ~ Name ~ Value
A ~ api ~ MyDigitalOceanIPv4
A ~ example.com ~ MyDigitalOceanIPv4
A ~ www ~ MyDigitalOceanIPv4
Crypto setup:
SSL: Full (strict)
Always use HTTPS: On
Automatic HTTPS Rewrites: On
I've also used Cloudflare to Create Certificate (and followed their instructions to set it up with Nginx)
My Nginx config:
server {
listen 443;
server_name example.com www.example.com;
ssl on;
ssl_certificate /srv/example.com/cloudflare.pem;
ssl_certificate_key /srv/example.com/cloudflare.key;
location / {
proxy_pass http://localhost:8000;
}
}
server {
listen 443;
server_name api.example.com;
ssl on;
ssl_certificate /srv/example.com/cloudflare.pem;
ssl_certificate_key /srv/example.com/cloudflare.key;
location / {
proxy_pass http://localhost:8080;
}
}
I have opened for all TCP ports on DigitalOcean, and if I try to open MyDigitalOceanIPv4:8000 in my browser then my website (hosted in a Docker container) successfully loads. However, if I try to open my website "example.com" then I get Cloudflare's 521 web server is down message.
I have also verified that the Cloudflare SSL key paths and content are correct, nginx -t shows no errors, and I've made sure to restart nginx after making changes.
I have also tried to whitelist Cloudflare's IPs using my Nginx config file but it didn't work.
If I try to telnet MyDigitalOceanIPv4 443 or 80 then I get telnet: Unable to connect to remote host: Connection refused.
Inside my DigitalOcean instance I have tried to curl http://localhost:8000 which successfully prints my website content.
I suspect there's some DigitalOcean setting I need to configure, or there's something wrong with my Nginx file (even though I've successfully used same Nginx config on a different cloud provider), but feel like I've tried everything..
I am in the process of migrating my wordpress, website www.programminginc.net, which is presently running on a shared hosting site, to a VPS Server with nginx Server. I have selected an Ubuntu 12.04.3 LTS server for my VPS hosting.
I could complete almost all jobs with the help of EasyEngine script and was successful in installing my website. After installation, my wordpress site URL was missing the www prefix. It was installed with the url [http://programminginc.net] not with [http://www.programminginc.net].
So, I changed the wordpress in dashboard general setting the WordPress Address (URL)
and Site Address (URL) [http://programminginc.net] to [http://www.programminginc.net]. After this change my website stopped working.
Can you help me figure out where the error is and how can I correct it? Is it the problem with wordpress or nginx itself? Thanks in advance.
Could be the configuration for nginx, make sure it is handling the request for www.example.com and make sure that there is an A record present for www
EasyEngine bydefault removed http:// https:// and www from the url and make website accessible via example.com and www.example.com
To make non-www to www you need to change the following file:
vim /etc/nginx/sites-available/example.com
# WPSINGLE BASIC NGINX CONFIGURATION
server {
server_name example.com www.example.com;
Replace above code with following lines
# WPSINGLE BASIC NGINX CONFIGURATION
server {
server_name example.com;
return 301 $scheme://www.example.com$request_uri;
}
server {
server_name www.example.com;
Track this issue on github easyengine page: https://github.com/rtCamp/easyengine/issues/71