国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > Nginx > 正文

nginx服務(wù)器搭建和配置詳解

2024-08-30 12:21:50
字體:
供稿:網(wǎng)友
本篇文章主要介紹了nginx服務(wù)器搭建和配置詳解,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

一、安裝編譯工具及庫文件

依賴庫安裝,一定要按照順序安裝:

(1) 如果沒有安裝c++編譯環(huán)境

 yum install gcc-c++

(2) ssl 功能需要 openssl 庫

wget https://www.openssl.org/source/openssl-1.1.0f.tar.gztar -zxvf openssl-1.1.0f.tar.gzcd openssl-1.1.0f./config make && make install

(3) rewrite 模塊需要 pcre 庫

wget https://ftp.pcre.org/pub/pcre/pcre-8.01.tar.gztar -zxvf pcre-8.01.tar.gzcd pcre-8.01./configure make && make install

(4) gzip 模塊需要 zlib 庫

wget https://nchc.dl.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gztar -zxvf zlib-1.2.11.tar.gzcd zlib-1.2.11./configure make && make install

(4) nginx安裝

wget http://nginx.org/download/nginx-1.12.1.tar.gztar -zxvf nginx-1.12.1.tar.gzcd nginx-1.12.1./configure --prefix=/usr/local/nginx make && make install

二、設(shè)置依賴庫連接

如果輸入語句:./usr/local/nginx/sbin/nginx出現(xiàn)錯誤:

error while loading shared libraries: libpcre.so.0: cannot open shared object file: No such file or directory

可輸入:

whereis libpcre.so.1

結(jié)果:libpcre.so: /lib64/libpcre.so.1 /usr/local/lib/libpcre.so /usr/local/lib/libpcre.so.0

再使用ln命令,將libpcre.so.0,libpcre.so和libpcre.so.1連接到lib64目錄下:

ln -s /usr/local/lib/libpcre.so.0 /lib64

三、Nginx 配置

創(chuàng)建 Nginx 運行使用的用戶 www:

/usr/sbin/groupadd www/usr/sbin/useradd -g www www

配置ngix.conf, 輸入:vi /usr/local/webserver/nginx/conf/nginx.conf的內(nèi)容修改為:

user www www;worker_processes 2;error_log ../error.log;pid    /usr/local/nginx/nginx.pid;worker_rlimit_nofile 65535;events {  use epoll;  worker_connections 65535;}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"'; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 8m; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; gzip on;  gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; server  {    listen    80;//端口    server_name localhost;//域名    index test.html index.htm index.php;//解析網(wǎng)頁名稱    root /usr/local/nginx/html; #站點目錄  location ~ .*/.(php|php5)?$  {   #fastcgi_pass unix:/tmp/php-cgi.sock;   fastcgi_pass 127.0.0.1:9000;   fastcgi_index index.php;   include fastcgi.conf;  }  location ~ .*/.(gif|jpg|jpeg|png|bmp|swf|ico)$  {   expires 30d; # access_log off;  }  location ~ .*/.(js|css)?$  {   expires 15d;  # access_log off;  }  access_log off; }}
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 阳泉市| 巴里| 曲麻莱县| 阿瓦提县| 集安市| 侯马市| 邵阳市| 伊春市| 钦州市| 普安县| 察雅县| 宁阳县| 望奎县| 肃宁县| 文化| 万年县| 浏阳市| 九龙城区| 青神县| 凤山市| 泰顺县| 浦江县| 崇义县| 黑河市| 敦煌市| 册亨县| 承德市| 宁安市| 石家庄市| 兴业县| 象山县| 锡林郭勒盟| 大冶市| 凯里市| 甘南县| 兴仁县| 新余市| 沈阳市| 文安县| 天祝| 绥江县|