Getting Nginx to point to a specific index.html pa

2019-06-10 04:48发布

I'm trying to get nginx to point to my index.html page along with imgs, CSS, JS, etc. that lies in a GoPATH, which is outside of /var/www/. My overall objective is to allow my website to run on port 80 and not 8080. Is it possible to do this? Below is what I currently have in the nginx.conf.

user www-data;

    http {
            include /etc/nginx/proxy.conf;
            index   index.html
    }

                  server { # simple reverse-proxy
            listen       80;
            server_name  dtrinh.com www.dtrinh.com;
            access_log   logs/dtrinh.access.log  main;

            # serve static files
            # serve static files
            location /  {
              root    /go/src/ps/views/default/index.html;
              expires 30d;

            # pass requests for dynamic content to rails/turbogears/zope, et al
            location / {
              proxy_pass      http://127.0.0.1:8080;
            }

        }

1条回答
Evening l夕情丶
2楼-- · 2019-06-10 05:11
location / {
    root /go/src/ps/views/default;
    error_page 404 = @backend;
    expires 30d;
}

location @backend {
    proxy_pass http://127.0.0.1:8080;
}

Reference:

查看更多
登录 后发表回答