ubuntu22 安装nginx

发布时间 2023-03-26 19:38:12作者: 世事浮云

# sudo apt update

sudo apt install libjasper1 libjasper-dev

# sudo apt-get install libgsl-dev

.# sudo apt-get install libpcre3 libpcre3-dev

# sudo apt-get install zlib1g-dev
# sudo apt-get install openssl libssl-dev
# sudo apt-get install gcc
 

  # ./configure --prefix=/home/nginx --sbin-path=/home/nginx/sbin/nginx --conf-path=/home/nginx/conf/nginx.conf --error-log-path=/home/log/nginx/error.log --http-log-path=/home/log/nginx/access.log --pid-path=/home/nginx/nginx.pid --lock-path=/home/nginx/nginx.lock --http-client-body-temp-path=/home/nginx/cache/client_temp --http-proxy-temp-path=/home/nginx/cache/proxy_temp --http-fastcgi-temp-path=/home/nginx/cache/fastcgi_temp --http-uwsgi-temp-path=/home/nginx/cache/uwsgi_temp --http-scgi-temp-path=/home/nginx/cache/scgi_temp --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module  --with-threads --with-file-aio --with-ipv6  --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=1024 -m64 -mtune=generic'

以下显示正常:

checking for ioctl(FIONREAD) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
checking for PCRE library ... found
checking for PCRE JIT support ... found
checking for OpenSSL library ... found
checking for zlib library ... found
creating objs/Makefile

Configuration summary
+ using threads
+ using system PCRE library
+ using system OpenSSL library
+ using system zlib library

nginx path prefix: "/home/nginx"
nginx binary file: "/home/nginx/sbin/nginx"
nginx modules path: "/home/nginx/modules"
nginx configuration prefix: "/home/nginx/conf"
nginx configuration file: "/home/nginx/conf/nginx.conf"
nginx pid file: "/home/nginx/nginx.pid"
nginx error log file: "/home/log/nginx/error.log"
nginx http access log file: "/home/log/nginx/access.log"
nginx http client request body temporary files: "/home/nginx/cache/client_temp"
nginx http proxy temporary files: "/home/nginx/cache/proxy_temp"
nginx http fastcgi temporary files: "/home/nginx/cache/fastcgi_temp"
nginx http uwsgi temporary files: "/home/nginx/cache/uwsgi_temp"
nginx http scgi temporary files: "/home/nginx/cache/scgi_temp"

./configure: warning: the "--with-ipv6" option is deprecated

 

编译(生成二进制文件)  并且安装    # make install

创建cache文件夹# cd /home/nginx/             #mkdir cache

赋权  # chmod -R 777  /home/nginx

删除安装文件   # rm -rf /home/nginx-1.22.3

安装结束

 

现在以下正常:

 test -d '/home/nginx/html' \

|| cp -R html '/home/nginx'
test -d '/home/log/nginx' \
|| mkdir -p '/home/log/nginx'
make[1]: 离开目录“/home/nginx-1.19.3”

 

运行  # ./home/nginx/sbin/nginx

停止  # ./home/nginx/sbin/nginx -s -stop