logo
down
shadow

Accessing nginx index.html on EC2


Accessing nginx index.html on EC2

By : John
Date : November 17 2020, 04:28 AM
I wish this help you I am not sure what I did wrong but I used this example instead and it's all working ok.
http://www.comtechies.com/2014/03/How-to-install-and-configure-nginx-on-amazon-ec2.html
code :


Share : facebook icon twitter icon
nginx /index.html to / rewrite

nginx /index.html to / rewrite


By : Edettloff
Date : March 29 2020, 07:55 AM
hope this fix your issue You final solution is totally fine.
if directive is evil ONLY IF it is inside a location block. Also you only have a return directive inside the if block. I don't see anything wrong with that. reference: http://wiki.nginx.org/IfIsEvil
code :
  index  index.html;
nginx index.html on all url

nginx index.html on all url


By : K-Soba
Date : March 29 2020, 07:55 AM
I wish did fix the issue. Using rewrite ... last inside a location block will just cycle around rewriting /index.html to /index.html. You should use rewrite ... break instead. See this document for details.
If your application also requires resources (css, js, images), you may adopt an alternative approach that returns the static file if it exists, for example:
code :
server {
    listen       80;
    root C:/Users/Sergey/Desktop/xxx/angular2do;

    location / {
        try_files $uri @other;
    }
    location @other {
        if ($request_method != POST) { rewrite ^ /index.html last; }
        proxy_pass http://localhost:3000;
    }
}
Nginx keeps looking for index.html

Nginx keeps looking for index.html


By : Vag Eesan
Date : March 29 2020, 07:55 AM
this one helps. The problem was that despite my own vhosts configuration being in /etc/nginx/conf.d/default.conf, nginx -T (which shows nginx's loaded configuration) didn't show the file having been read.
The include /etc/nginx/conf.d/*.conf; directive was missing from my nginx.conf.
NGINX - Spring Boot app ( "/etc/nginx/html/index.html" is not found )

NGINX - Spring Boot app ( "/etc/nginx/html/index.html" is not found )


By : user2845846
Date : March 29 2020, 07:55 AM
will help you Ok i figured it out, and i even managed to fix it so it works with resources that have hash prefixes:
code :
events {
  worker_connections 1024;
}

http {

  server {
        listen 80;
        charset utf-8;
        access_log off;
        try_files $uri $uri/ =404;

        location / { #this still has to be here, otherwise i get ISE
            proxy_pass http://workaround:8085/;
        }

        location ^~ { #this thing fixes hashes and resources
            proxy_pass              $scheme://workaround:8085/$request_uri;
            proxy_redirect  off;
            proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header        Host $http_host;
            expires 30d;
         }
    }


}
Accessing docker container websocket through nginx or traefik via html web page?

Accessing docker container websocket through nginx or traefik via html web page?


By : user3678890
Date : March 29 2020, 07:55 AM
I hope this helps . I have two docker containers running - one has a websocket and the other is an nginx container. Setup using docker-compose.yml as follows: , Use links to access the other container via hostname:
code :
version: "3.5"

services:
  websocket: 
    build:
      context: .
      dockerfile: Dockerfile
    container_name: websocket
    ports: 
      - "6000:7000"

  nginx:
    image: dperson/nginx
    container_name: nginx
    ports:
      - "120:80"
    environment:
      - STREAM=0.0.0.0:80;websocket:7000
    links:
      - websocket
version: "3.5"

services:
  websocket: 
    build:
      context: .
      dockerfile: Dockerfile
    container_name: websocket
    ports: 
      - "6000:7000"
    networks:
      - default

  nginx:
    image: dperson/nginx
    container_name: nginx
    ports:
      - "120:80"
    environment:
      - STREAM=0.0.0.0:80;websocket:7000
    links:
      - websocket
    networks:
      - default

networks:
  default:
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org