I added about 4700 domains to my server (nginx webserver) but I can`t add more domains - nginx

I added over 4700 domain to my server by add site configuration setting in nginx webserver. these sites are working very well.
But I want to add more domains (about 7000 more) I set DNS name of domains to the server and created the nginx config file and there was no exception in nginx -t. I reloaded nginx service successfully but my new sites are not online.
If I go to my new website the chrome shows me following error page:
This site can’t be reachedCheck if there is a typo in zoratco.ir.
If spelling is correct, try running Windows Network Diagnostics.
DNS_PROBE_FINISHED_NXDOMAIN
I increased server_names_hash_max_size and server_names_hash_bucket_size values but that`s not working

Related

Using a load balancer with digital ocean droplets that points to a cloudflare dns

Using digital Ocean, I created a load balancer which is linked to 2 droplets. Both droplets have NGINX installed and when I test the load balancer ip address on a browser, it correctly toggles between droplet 1 and 2.
The issue now is I want to point the load balancer to a subdomain I created on CloudFlare. Lets say my domain is example.com. I wanted to create a subdomain called api.example.com (which is an A record on Cloudflare). This should be simple. I created the A record on Cloudflare and linked it to the digital ocean load balancer ip address.
When I try to see if api.example.com works on the browser, I get a 522 error where the connection times out.
Since my name servers are being managed on Cloudflare and my droplets(virtual machines) are on Digital Ocean, do I need to set up port forwarding from http to https? I don't have much experience here.
Anyone ever encounter this and know the steps to get the subdomain to work?
Do I need to create config nginx site files with server blocks in each droplet and use Lets Encrypt and Certbot?
If so, where does the load balancer ip address fit in. Since I'm doing this on each individual droplet, I'm having a hard time wrapping my head around how to incorporate config for a load balancer since it technically isn't a vm I can log into and install NGINX (as far as I know).
Any help would be greatly appreciated.
The solution I found to work is in the load balancer settings in Digital Ocean. Set a new port forwarding rule for port 443 and set the SSL to pass through. Once that is done, you will need to go into the /etc/nginx/sites-available and either update the default or create a new .conf file where you define a new server block. In my example below, I created a custom html directory and page in the /var/www folder.
server {
root /var/www/example.com/html;
index index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ =404;
}
Once this is done, you need to create a link between sites-enabled folder. For full details on how to create this type of file, I used this as a guide (its a bit outdated but it still works).
Create & Deploy an Express Rest API to a Digital Ocean Server
Once the conf file is created and the server blocks are set up, you can follow this link for SSL passthrough.
How to Configure SSL Passthrough - Digital Ocean
Essentially for this to work correctly, you can use Certbot to create a SSL certificate so Https can work. You can either do this on each Virtual Machine or Digital Ocean has a way to create an image of a droplet. So my advice is to do all your configuration on one droplet and get the https to work correctly (meaning you can go to the site address and not the ip and it works). Another way to do this is document all your steps one on VM and use a devOps tool like Ansible to automate this so you dont have to manually customize each machine.
Once both sites work ( you can test the subdomain against each droplet to test before switching the subdomain to point to the load balancer), you can then set your load balancer ip address back to the cloudflare A record for your domain or subdomain.
SSL pass through from my understanding lets the load balancer pass any SSL certificate checks to each individual droplet associated with the load balancer. So do keep mind that if you are managing one or many certificates for each droplet and if any expire, that droplet wont work. Hopefully this helps.

Nginx as Reverse Proxy for Prestashop

I have this scenario with Nginx as reverse proxy and Prestashop:
I have Prestashop installed as a container with Proxmox and it has been configured with a local IP address (192.168.0.10) instead of a domain name. I can access Prestashop via the local IP without problems through the local network.
I have nginx as a reverse proxy installed on another VM that receives the request with a domain name (subdomain.example.com) with an SSL certificate on the Nginx, and makes a proxy_pass for the local IP address (192.168.0.10).
When the request is made via the external domain Prestashop redirects [subdomain.example.com] to [192.168.0.1] which is not expected.
With other attempts returns the error (too many redirects) ...
other attempts returns the error 500 ...
I've already tried to enable SSL on prestashop, assign the domain [subdomain.example.com] on prestashop, activate multistore and several other attempts without any success.
I found a tutorial that suggest do edit de [Link.php] file on Prestashop but don't work for me too.
I can't find any material on the web that solves this problem, nor in the Prestashop documentation, so I ask for your help.
This is probably a misconfiguration in Prestashop as your webserver config is pretty straightforward.
Please make sure :
that your DB table ps_shop_url is containing the correct subdomain.example.com in domain and domain_ssl row.
that .htaccess file in Prestashop in root folder is not containing references to your backend IP (192.168.0.1) - If this is the case, you'll need to regenerate in from backoffice (click SAVE in Seo&URL tab )

aws centos 7 wordpress apache redirect

I've got EC2 Amazon Linux 2 instance with apache, mariadb and wordpress
VPC, Security group, ACL are set up correctly, i'm using same rules for other websites and works perfectly
telnet ip 443 and telnet ip 80 - both are reachable, checked and connected
I don't have access to DNSes, so I changed windows host file. Both are pointing to the same ip.
x.x.x.x example.com
x.x.x.x example.sandbox.com
ping recognize both and showing that there is no issue with host file.
First website with SSL.
Second website without SSL (tests purposes).
They are using same database but different schema. So table
wp_options and value for home and siteurl are set up correctly for
https://example.com for first one and http://example.sandbox.com for
test one.
First website is working fine, showing example.com with SSL. Nothing to do. Problem is with test environment. Everytime I try to reach example.sandbox.com chrome first shows me warning that page is not secured (expected) and after that redirects me to example.com. Same with Firefox. After added exception it redirects me to example.com. I run out of ideas...
Apache configs in comment. Have no idea how to paste it into post without error. Spent hour on it...
Found it!
Wordpress plugin really-simple-ssl. Removed it and it works.

GoDaddy domain in AWS with SSL for Wordpress application Issue

Currently, I am working on a Wordpress application and I am using AWS hosting. My domain is in GoDaddy.com and I have deployed the application in elastic beanstalk. I have created load balancer and also I need to run the application through HTTPS.
I have done my research and I think I found the right way, but it's not working for HTTPS. when I browse on HTTP on port 80, it runs well. Now I am helpless.
Here's what I have done so far:
1) I created a hosted zone on AWS Route 53 for the domain named "example.com". There are two records are created, NS and SOA.
2) Then, in GoDaddy, I added NS records from AWS as Custom Nameservers.
3) After that, I created A record for the domain in the AWS hosted zone, set ALIAS targeted to the Load Balancer of the Elastic Beanstalk environment.
4) Then, I changed the SITE URL from the wp_options table the wordpress application database.
After doing up to this, my application was running in HTTP. But as I want to change it to HTTPS. So,
1) I requested a certificate from AWS Certificate Manager and created CNAME (provided by ACM after requesting certificate) record in the hosted zone.
2) After the certificate is issued, I edited the listener from EC2 >> Load Balancer >> Listener and changed the protocol from HTTP to HTTPS and also allowed port on Security groups.
3) Also, I changed, the SITE URL from WordPress database and changed it from "http://example.com" to "https://example.com" but it was not working.
4) So I went to Elastic Beanstalk >> Configuration >> Load Balancer and added listener. After the environment is saved and restarted, still, the site was not running on HTTPS [ HTTP 408 ERROR IS SHOWN ]. But if I change SITE URL to "http://example.com", it works
I have found a solution, which says to use RedirectURL and set it to server config but I don't want to do that.
I also found this solution which suggest to Export Zone File and import it to AWS hosted zone. But whenever I click Export Zone File(Unix), the file downloaded is shown empty. I tried this for other accounts, still, this problem exists. So I did not do that.
Sorry for the long story, but I really need this help.
I have solved the issue.
In my load balancer port configuration, I previously set load Balancer port 443 and instance 443. here what I need to do is to call the load balancer on port 443 and backend make the backend call on port 80 and enable https on WordPress.
So I kept load balancer port 443 and changed the instance port to 80. After that, on the browser, there was too many redirects error shown. So then what I needed to do is that add $_SERVER['HTTPS'] = 'on' on wp-config. And then everything was running smoothly.
I hope this will help if some

How to configure IIS to redirect to site

So far I downloaded and configured IIS (version 10) on my windows machine. I created a domain called kinux, using the hosts file, so when I navigate to kinux.com, I'm brought to my IIS server root directory. I then created a site called localwww and configured ColdFusion to run via this site.
What I'm trying to do is make it so that when I go to kinux.com, it redirects me to my ColdFusion site. Does anyone know how to do this?
hosts
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 Kinux
127.0.0.1 Kinux.com
localwww site
Default site
Two solutions that I can think of:
Move your ColdFusion site to port 80 and add binding for hostname "kinux.com" such that all incoming requests to kinux.com will be served by your ColdFusion site.
Assuming "Desktop-server" is the website that gets called when you enter "kinux.com, click on it in IIS manager. In the center panel you will find "HTTP Redirect". Set the URL of ColdFusion website here. What will happen now is any request coming in to "Desktop-server" website would be redirected to your cold fusion website.
In solution 2, an important thing to note here is that the when the first request reaches "Desktop-server" site, IIS will indicate to the client (browser from where it is being accessed) that a redirect rule has been set to the new URL. The client will now once again make a new request to the new address (ColdFusion). So please ensure that the URL you enter in HTTP redirect rule can be accessed by client machine as well.
Let me know if you have any questions.

Resources