您的位置:首页 > 运维架构 > Nginx

CentOS 6.4使用Nginx配置文件服务器

2015-05-18 23:44 651 查看
目的:通过http协议访问ftp目录中的文件

步骤:一:安装nginx,并修改其目录    二:安装vsftp(在另一篇博文中有)

1、配置CentOS 6.2 第三方yum源(CentOS默认的标准源里没有nginx软件包):

  yum install wget    #安装下载工具wget
  wget http://www.atomicorp.com/installers/atomic  #下载atomic yum源
  sh ./atomic   #安装
  yum check-update  #更新yum软件包

  2、安装nginx:
  yum install nginx      #安装nginx,根据提示,输入Y安装即可成功安装
  #修改配置文件,这里省略,主要是将目录指定到 /home/ngmsw-files
  service nginx start    #启动
  chkconfig  nginx on    #设为开机启动

更改nginx网站根目录方法:

默认网站根目录为/usr/local/nginx/html,要将它改成/homw/www

vi /usr/local/nginx/conf/nginx.conf

将其中的

        location / {
            root   html;
            index  index.php index.html index.htm;
        }

改为

        location / {
            root   /home/www;
            index  index.php index.html index.htm;
        }

然后再将

location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

改为

location ~ \.php$ {
            root           /home/www;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

然后重启nginx

已经安装了samba,所以要将vi /etc/samba/smb.conf中的[public]下的path值改为

path = /home/www/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nginx 文件服务器