安装Nginx详细步骤
注意:如果遇到重复安装Nginx: 你需要先rm -rf /usr/local/nginx/ 然后rm -rf /var/temp/nginx/ 最后 重新安装nginx即可
5.7 安装nginx及fastdfs-nginx-module
1. 解压缩nginx-1.8.1.tar.gz
2. 解压缩fastdfs-nginx-module-master.zip
3. 进入nginx-1.8.1目录中
4. 执行
sudo ./configure --prefix=/usr/local/nginx/ --add-module=/root/FastDFS/fastdfs-nginx-module-master/src
make
make install
5. sudo cp /root/FastDFS/fastdfs-nginx-module-master/src/mod_fastdfs.conf /etc/fdfs/mod_fastdfs.conf
6. sudo vim /etc/fdfs/mod_fastdfs.conf
修改内容:
connect_timeout=10
tracker_server=自己ubuntu虚拟机的ip地址:22122
url_have_group_name=true
store_path0=/root/fastdfs/storage
7. sudo cp /root/FastDFS/fastdfs-master/conf/http.conf /etc/fdfs/http.conf
8. sudo cp /root/FastDFS/fastdfs-master/conf/mime.types /etc/fdfs/mime.types
9.sudo vim /usr/local/nginx/conf/nginx.conf
在http内添加配置信息如下:
server {
listen 8888;
server_name localhost;
location ~/group[0-9]/ {
ngx_fastdfs_module;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
10. 启动nginx
sudo /usr/local/nginx/sbin/nginx
停止
sudo /usr/local/nginx/sbin/nginx -s stop