首页 > 系统服务 > 详细

Ubuntu环境下配置Nginx

时间:2015-04-27 14:55:57      阅读:263      评论:0      收藏:0      [点我收藏+]

/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
        }

...

 

Ubuntu环境下配置Nginx

原文:http://www.cnblogs.com/feika/p/4459869.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!