Ubuntu14.04和Ubuntu12.04都可以
参考来源:
使用nginx搭建简单的文件服务器
/etc/Nginx
hhb@ubuntu:/etc/Nginx$ ls -lth
total 64K
drwxr-xr-x 2 root root 4.0K Oct 20 00:10 sites-available
drwxr-xr-x 2 root root 4.0K Oct 19 23:37 sites-enabled
drwxr-xr-x 2 root root 4.0K Jun 2 23:16 conf.d
-rw-r--r-- 1 root root 911 Mar 5 2014 fastcgi_params
-rw-r--r-- 1 root root 2.3K Mar 5 2014 koi-utf
-rw-r--r-- 1 root root 1.8K Mar 5 2014 koi-win
-rw-r--r-- 1 root root 2.1K Mar 5 2014 mime.types
-rw-r--r-- 1 root root 5.2K 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 1.6K Mar 5 2014 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
-rw-r--r-- 1 root root 532 Mar 5 2014 uwsgi_params
-rw-r--r-- 1 root root 3.0K Mar 5 2014 win-utf
进入sites-available
有个default文件
首先备份default文件
cp default default.backup
20 server {
21 listen 80 default_server;
22 listen [::]:80 default_server ipv6only=on;
23
24 root /home/hhb/work/catmaid_5d_visualization_annotation/httpdocs/data;
25
26 # Make site accessible from http://localhost/
27 server_name localhost;
28
29 location / {
30 # First attempt to serve request as file,then
31 # as directory,then fall back to displaying a 404.
32 try_files $uri $uri/ =404;
33 # Uncomment to enable naxsi on this location
34 # include /etc/Nginx/naxsi.rules
35 autoindex on;
36 autoindex_exact_size on;
37 autoindex_localtime on;
38 }
这里root 就是Nginx服务器的根目录 其中server_name可以自己起一个喜欢的名字