Welcome! Log In Create A New Profile

Advanced

Re: newbie needs help

Valentin V. Bartenev
May 30, 2013 06:26AM
On Thursday 30 May 2013 14:02:00 angelochen960 wrote:
> Hi,
> new in ths nginx, with following config, I want to achieve:
>
> http://sample.com/ render index.html
> http://sample.com/test, or anything after '/' path, render index.html
>

server {
listen 80;
server_name sample.com;

root /var/www/sample/public_html;

location / {
try_files /index.html =404;
}
}


> server {
> listen 80;
> server_name sample.com ;
> root /var/www/sample/public_html;
>
> location / {
> index index.html index.htm;
> }
>
> location ~ ^/.* {
> index index.html;
> }
>
>
> }
>
> but when I do this, and got 404 error, anything missing here? Thanks Angelo
>
> curl -I http://sample.com/test
>
> HTTP/1.1 404 Not Found
>

Since your config looks incorrect, it seems you are missing understanding of how
nginx works.

You should try to read documentation:

- http://nginx.org/en/docs/http/request_processing.html
- http://nginx.org/r/location
- http://nginx.org/r/index
- http://nginx.org/r/try_files


wbr, Valentin V. Bartenev

--
http://nginx.org/en/donation.html



_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

newbie needs help

angelochen960 May 30, 2013 06:02AM

Re: newbie needs help

Valentin V. Bartenev May 30, 2013 06:26AM

Re: newbie needs help

angelochen960 May 30, 2013 08:25AM

Re: newbie needs help

Valentin V. Bartenev May 30, 2013 09:48AM

Re: newbie needs help

angelochen960 May 30, 2013 10:19AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 97
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready