Deployment of nginx installation manual and image server

Source: Internet
Author: User

1. Install gcc

Yum install gcc

 

2. Install PCRE and PCRE-devel

Create the source build directory under the zhoulh directory

Mkdir source build

Go to the build directory

Create a PCRE directory

CD PCRE

 

Wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.zip

The PCRE version may change over time.

Ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/#latest version

Decompress the package

Unzip pcre-8.35.zip

 

Enter the PCRE directory

CD pcre-8.35

Step 1:./configure

Step 2: Make

Execute Part 3: make install

 

3. Install nginx

CD Source

Download nginx

You can view the latest version at http://nginx.org/download/


 

Extract

 

Run configure with the following command:


Start Compilation:

 

Start Installation

 

Start nginx


Enter http: // ip

The following screen is displayed. If the following screen is not displayed, check whether port 80 is enabled in the/etc/sysconfig/iptables file.

 


To deploy an image server, follow these steps:

1. Modify the nginx. conf file


Modify as follows:

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: for the purpose of defining the image display size, crop is the Rotation Degree of the switched image, and R must be an integer of 90.

For example, http: // 192.168.3.158/image/1.jpg? R = 180.
2. test whether the nginx. conf file is correct.


3. Restart nginx


4. Enter the address to view the image


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.