My Website is Accessible via domain.com/index.html but not with domain.com - webserver

I'm sorry for this stupid question, but I'm very new to hosting and domain things and I need help. My Website PrepareHOW.org is not accessible with PrepareHOW.org but can be visited via Preparehow.org/index.html How can I remove this error so that people can access my website with my domain url.

If you using nginx as frontend of webserver just check config for this domain.
This lines need to add to config:
root /path/to/site/root/folder;
location / {
try_files $uri /index.html$is_args$args;
}
Then restart nginx and check result!

Related

API call not working if including www in the URL

I just migrated my web app from a server that was using Apache to a new server using Nginx. Everything is fine, except for my API routes.
I'm testing with POSTMAN, and if I use https://www.example.com/api/example I just get a response with an empty "message" variable.
But if I use https://example.com/api/example, it works fine.
I have a mobile app pointing to the URL which includes WWW, and I don't want to make an update just to make this change. How can I make the route including WWW work again?
You need to change the host name in nginx config file to include www.
Sample:
server {
listen 80;
server_name example.org www.example.org;
...
}

AWS Route 53 CNAME

This has to be simple. I have an A record that points to my server just fine. However, I just added a CNAME for a "www".website.com that points to website.com, but it is now just returning an Nginx 404 error. For reference, I'm using Laravel Forge to deploy the server and of course AWS Route 53 for DNS.
I want to post an answer in case anyone comes across this issue like I did. I was unaware that this can be solved by configuring the Nginx config file and through Laravel Forge, it's pretty easy.
On my server, I have 2 sites (one pointing to site.com and one pointing to www.site.com). In my DNS provider (AWS Route 53), I have an A record for each URL and both point to the public IP of my server.
So, I go into the Nginx config (through Laravel Forge) for the site I want to redirect (in this case I want to go from www to non-www) and edit the config file to include the following.
server_name www.site.com;
return 301 $scheme://site.com$request_uri;
Works perfectly now!

Redirection with nginx

Using this tutorial
http://rainbow-six3.com/plesknginx/ i am trying to redirect my name.com to ip:8080 , after that setup if i acces through name.con i get an redirection loop... is there any other service to redirect? Had a lot of problems with nginx.
I want to redirect name.com to an tomcat7 application wich uses ip:8080 to get executed. Tomcat is already an headache...
Neither this helped me:
Tomcat base URL redirection
It outputs webpage not available on link: http://name.com/index.jsp
Mind the words. 'Redirecting' != 'Proying'. You redirect through 301 or 302 to a publicly directly accessible resource, while you proxy to a backend, not supposed to be directly accessed.
The minimal configuration to proxy any name.com/<whatever> request to <ip>:8080/<whatever> is:
server {
listen 80;
server_name name.com;
location / {
proxy_pass $scheme://<ip>:8080;
}
}

nginx load balancing keep redirect me wrong

hi i have nginx server and other webserver which i want to hide from public direct access. but when i try to access that server on root i send redirect response to client to url like this: server/test/spring/main. when i try to access it from nginx server i get the server url redirect instead nginx url.
example:
my-nginx.com
my-server.com
if i want to access myserver.com/test/spring/main from nginx server i guess i have to access my-nginx.com/test/spring/main but when i do that i get redirect to url myserver.com...
my config:
upstream my-server {
server my-server.com;
}
server {
listen 80;
server_name my-nginx;
location / {
proxy_pass http://my-server/;
}
}
the other think is when i access the root page on my-server.com i redirect the client to "https://my-server.com/test/spring/main".
Why i'm redirect from my-nginx.com url to my-server.com?
This configuration seems do not have big problem, and I also use proxy_pass to access other domain in our production environment, and do not redirect.
You should be care of the last '/' in "http://my-server/", usint "http://my-server" instead, or just using "http://my-server.com" with no upstream.
The behavior with '/' or with not '/' is a little different.

nginx redirect mask

I'm new to nginx and am trying to figure out an issue with redirection. I'm trying to redirect a website from a host running a web application to another domain. That part I've done but I'm looking to mask it. When it redirects, I don't want the user to know they've gone to another domain.
I've substituted the domain names for privacy of my client. But, they are on a Linode at test.com that's running a web application that's at sub.test.com. All I want is for any user visiting test.com to be redirected to a temporary site hosted on other.com but without exposing the domain.
Previously, someone had shown me how to do it but it was a long time ago and I no longer have the information to reference. Can someone help me out? I don't want to expose the domain of the testing environment.
server {
listen 80;
server_name www.test.com test.com www.test.net test.net;
rewrite ^ http://other.com/sub redirect;
location / {
root /srv/http/www.test.com;
index index.html;
}
}
You can't do that with redirect, cause redirect is actually like telling the browser where to fetch page from, so you can't obscure the real location.
I guess what you need is proxying, e.g. a client requests some document from your server (test.com), then your server fetches the document from some other server (other.com) and returns that document to a client as if it was generated on test.com - it that case a client won't be able to determine where actually the document is originating from.
This can be done with:
server_name test.com;
location / {
proxy_pass http://other.com;
}
if you want the redirect to not change the user-visible domain name then you need to change it from a 301 to a 302 by changing your rewrite as follows:
rewrite ^ http://other.com/sub redirect;