Linux常用命令全集及用法 linux操作系统常用命令全集(10)
Linux常用命令全集及用法
4、编译并安装
make && make install
11.6.2 如果已经安装过nginx
1、 进入nginx目录:
cd /usr/local/项目名/nginx-1.10.0/
2、 配置FastDFS 模块
./configure --prefix=/opt/nginx --sbin-path=/usr/bin/nginx --add-module=/usr/local/项目名/fastdfs-nginx-module/src
注意:这次配置时,要添加fastdfs-nginx-moudle模块
3、编译,注意,这次不要安装(install)
make
4、替换nginx二进制文件:
备份:
mv /usr/bin/nginx /usr/bin/nginx-bak
用新编译的nginx启动文件替代原来的:
cp objs/nginx /usr/bin/
11.6.3 启动nginx
配置nginx整合fastdfs-module模块
我们需要修改nginx配置文件,在/opt/nginx/config/nginx.conf文件中:
vim /opt/nginx/conf/nginx.conf
将文件中,原来的server 80{ ...} 部分代码替换为如下代码:
server {
listen 80;
server_name image.项目名.com;
# 监听域名中带有group的,交给FastDFS模块处理
location ~/group([0-9])/ {
ngx_fastdfs_module;
}
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
启动nginx:
nginx # 启动nginx
nginx -s stop # 停止nginx
nginx -s reload # 重新载入配置文件
# 可通过ps -ef | grep nginx查看nginx是否已启动成功
11.6.4 设置nginx开机启动
创建一个开机启动的脚本:
vim /etc/init.d/nginx
添加以下内容:
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: NGINX is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/bin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/opt/nginx/conf/nginx.conf"
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
make_dirs() {
# make required directories
user=`$nginx -V 2>&1 | grep "configure arguments:.*--user=" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
if [ -n "$user" ]; then
if [ -z "`grep $user /etc/passwd`" ]; then
useradd -M -s /bin/nologin $user
fi
options=`$nginx -V 2>&1 | grep 'configure arguments:'`
for opt in $options; do
if [ `echo $opt | grep '.*-temp-path'` ]; then
value=`echo $opt | cut -d "=" -f 2`
相关阅读
-
linux服务器搭建教程案例 ssh命令远程连接linux服务器步骤
本文导读:linux服务器搭建教程案例和ssh命令远程连接linux服务器步骤的IT小经验,接下来IT袋带大家一起了解。 前言 本文讲解Linux系统下如何搭建SVN服务器,详细说明各配置项的功能,最终实
-
explorer.exe找不到应用程序 windows找不到文件explorer.exe解决教程
本文为您带来的是windows找不到文件explorer.exe解决教程方面的内容,关于windows找不到文件explorer.exe解决教程,一定能解决您的问题的,一起来了解吧! 大部分的用户在进入系统后都遇到过wind
-
win7流畅还是win11流畅 win11和win7流畅度对比介绍
今天小编介绍win11和win7流畅度对比介绍的相关经验,关于win7流畅还是win11流畅 win11和win7流畅度对比介绍,接下来就是全面介绍。 win7是十年前使用的windows系统,当时是一款非常好用,稳定性非
-
电脑自己怎么重装系统 自己组装电脑系统的详细流程
为大家介绍的是电脑自己怎么重装系统和自己组装电脑系统的详细流程的IT小经验,接下来就是全面介绍。 上期教了大家如何制作U盘启动盘,那么 这期自然是教大家如何重装系统了, 其实,


