Ubuntu环境下配置Nginx

/etc/nginx目录文件下:

drwxr-xr-x   5 root root 4096 Apr 27 12:47 ./

drwxr-xr-x 104 root root 4096 Apr 27 11:54 ../

drwxr-xr-x   2 root root 4096 Feb 12 00:26 conf.d/

-rw-r--r--   1 root root  911 Mar  5  2014 fastcgi_params

-rw-r--r--   1 root root 2258 Mar  5  2014 koi-utf

-rw-r--r--   1 root root 1805 Mar  5  2014 koi-win

-rw-r--r--   1 root root 2085 Mar  5  2014 mime.types

-rw-r--r--   1 root root 5287 Mar  5  2014 naxsi_core.rules

-rw-r--r--   1 root root  287 Mar  5  2014 naxsi.rules

-rw-r--r--   1 root root  222 Mar  5  2014 naxsi-ui.conf.1.4.1

-rw-r--r--   1 root root 1602 Apr 27 12:45 nginx.conf

-rw-r--r--   1 root root  180 Mar  5  2014 proxy_params

-rw-r--r--   1 root root  465 Mar  5  2014 scgi_params

drwxr-xr-x   2 root root 4096 Apr 27 12:46 sites-available/

drwxr-xr-x   2 root root 4096 Apr 27 12:46 sites-enabled/

-rw-r--r--   1 root root  532 Mar  5  2014 uwsgi_params

-rw-r--r--   1 root root 3071 Mar  5  2014 win-utf

 

修改文件sites-enabled/default

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /usr/share/nginx/html;
        index index.html index.htm;

        # Make site accessible from http://localhost/
        server_name localhost;

        location /api/v1 {
                proxy_pass http://127.0.0.1:8080/api/v1;
                proxy_set_header Host $http_host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

...

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。