编译安装Ningx1.10.2

1. 下载nginx、pcre、zlib、openssl
# wget http://nginx.org/download/nginx-1.10.2.tar.gz
# wget https://ftp.pcre.org/pub/pcre/pcre-8.38.tar.gz
# wget https://ncu.dl.sourceforge.net/project/libpng/zlib/1.2.10/zlib-1.2.10.tar.gz
# wget http://distfiles.macports.org/openssl/openssl-1.0.2h.tar.gz
2. 解压*.tar.gz文件
# tar -zxvf <file_name>.tar.gz
3. 编译、安装、启动
# ./configure --prefix=/usr/local/nginx --with-pcre=/root/softs/pcre-8.38 --with-zlib=/root/softs/zlib-1.2.10 --with-openssl=/root/softs/openssl-1.0.2h

# make && make install

# nginx
4.配置nginx(已有nginx用户和组的情况下)
# cd /usr/local/nginx
# mkdir -p /usr/local/nginx/conf/conf.d
# vim conf/nginx.conf
---------------------------------
user nginx;
worker_processes auto;
error_log /data/log/nginx/error.log;
pid /var/run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections  1024;
}
http {
    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  /data/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /usr/local/nginx/conf/mime.types;
    default_type        application/octet-stream;
    include /usr/local/nginx/conf.d/*.conf;
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容