1. 安装gcc
yum install gcc
2. 安装pcre,pcre-devel
在zhoulh文件夹下建立source build文件夹
mkdir source build
进入build文件夹
创建pcre文件夹
cd pcre
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.zip
pcre的版本号随着时间可能会变动。能够进入
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/查看最新版本号
解压缩压缩包
unzip pcre-8.35.zip
进入pcre文件夹
cd pcre-8.35
运行第一步:./configure
运行第二步:make
运行第三部:make install
3. 安装nginx
cd source
下载nginx版本号
最新版本号能够到http://nginx.org/download/查看
解压缩
执行configure,例如以下命令:
開始编译:
開始安装
启动nginx
显演示样例如以下画面,假设未出现例如以下画面,则查看/etc/sysconfig/iptables文件是否开放80port
下面步骤部署图片server
1. 改动nginx.conf文件
改动例如以下
user root;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
image_filter test;
#image_filter resize $arg_w $arg_h;
#image_filter crop $arg_w $arg_h;
#image_filter rotate $arg_r;
#alias /usr/local/nginx/html/image/;
}resize为重定义图片显示大小 crop为切图 rotate为旋转r度,r必须为90的整数
如:http://192.168.3.158/image/1.jpg?
r=180
2. 測试nginx.conf文件是否正确
3. 重新启动nginx
4. 输入地址查看图片