[root@xupan001 vhost]# ls
www.xupan001.com.conf www.xupan001.img.com.conf
[root@xupan001 vhost]# pwd
/usr/local/nginx/conf/vhostphp
vim www.xupan001.img.com.conf
添加以下內容:
server {
listen 80;
autoindex off;
server_name www.xupan001.img.com;
access_log /usr/local/nginx/logs/access.log combined;
index index.html index.htm index.jsp index.php;
#error_page 404 /404.html;
if ( $query_string ~* ".*[\;'\<\>].*" ){
return 404;
}
#location ~ /(mmall_fe|mmall_admin_fe)/dist/view/* { deny all; }
location / {
root /usr/local/devtools/ftpfile/img/;
add_header Access-Control-Allow-Origin *;
}
}html
xpMac:~ xupan$ vim /etc/hosts
192.168.48.11 www.xupan001.com
192.168.48.11 www.xupan001.img.comnginx
文件服務器地址:
[root@xupan001 ftpfile]# ll
total 12
drwxr-xr-x 2 root root 4096 Jun 1 17:33 img
-rw-r--r-- 1 root root 55 Jun 1 12:47 index.html
drwxr-xr-x 2 ftpuser ftpuser 4096 Jun 1 13:51 shoop001
[root@xupan001 ftpfile]# pwd
/usr/local/devtools/ftpfile
[root@xupan001 ftpfile]# ls img/
jay001.jpgvim
Mac瀏覽器輸入:http://www.xupan001.img.com/jay001.jpg瀏覽器