##기본 설정
mkdir -p /usr/local/src/NPM_Setup
export SOURCE_DIR=/usr/local/src/NPM_Setup
yum install -y vim wget epel-release
cd $SOURCE_DIR
yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum update -y
##디폴트환경변수
echo " " >> /etc/profile
echo "####default PATH#####" >> /etc/profile
echo "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:" >> /etc/profile
echo "#####################" >> /etc/profile
##소스설치를 위한 패키지 환경 설치
yum install -y libdb-devel enchant-devel libxslt libxslt-devel net-snmp-devel readline-devel readline aspell-devel unixODBC unixODBC-devel libicu-devel icu libicu libc-client libc-client-devel libc-client-2007f freetype-devel freetype* freetype libXpm libXpm-devel libpng-devel libpng* libvpx-devel libvpx libcurl libcurl-devel curl* curl-devel curl tcp_wrappers-devel libzip environment-modules uw-imap-utils uw-imap-devel uw-imap uw-imap-static pam-devel libldb-devel openldap-devel cyrus-sasl-devel bzip2-devel bzip2 bzip2-libs ncurses-devel ncurses mysql-devel libjpeg-devel libjpeg* libjpeg-devel openssl-devel openssl* openssl-libs libxml* libxml2 libxml2-devel libmcrypt libmcrypt-devel libmcrypt* mcrypt mhash* mhash mhash-devel libmhash libmhash-devel expat-devel expat expat* gmp* gmp gmp-devel krb5* krb5-devel db4 db4-devel wget make cmake libtool* pcre* gdbm* gdbm gdbm-devel libtiff* libtiff libtiff-devel flex zlib* zlib-devel zlib gd* gd gd-devel patch t1lib t1lib-devel readline libedit-devel libtidy libtidy-devel gcc* gcc gcc-c++ libtermcap-devel dialog sqlite-devel oniguruma oniguruma-devel libzip5 mod_ssl postgresql-devel lcov systemtap-sdt-devel mod_ldap elfutils-devel libwebp-devel libwebp git gzip libnghttp2-devel valgrind* mod_proxy* editline editline-devel patchelf systemd-devel ImageMagick-devel libzstd-devel libffi libffi-devel libraqm-devel libraqm libsodium libsodium-devel perl-ExtUtils-Embed gperftools-devel libatomic_ops-devel tree geoip-devel
##nginx 다운로드 및 배포
cd /usr/local/src/NPM_Setup
wget http://nginx.org/download/nginx-1.22.1.tar.gz
tar zxvf nginx-1.22.1.tar.gz
cd nginx-1.22.1
##nginx 소스 컴파일 설치
./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/sbin/nginx \
--modules-path=/usr/local/nginx/modules \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--error-log-path=/usr/local/nginx/logs/error_log \
--user=nobody \
--group=nobody \
--with-threads \
--with-select_module \
--with-threads \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module \
--with-http_image_filter_module \
--with-http_geoip_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_auth_request_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-http_perl_module \
--http-log-path=/usr/local/nginx/logs/access_log \
--http-client-body-temp-path=/usr/local/nginx/tmp/body \
--http-proxy-temp-path=/usr/local/nginx/tmp/proxy \
--http-fastcgi-temp-path=/usr/local/nginx/tmp/fastcgi \
--http-uwsgi-temp-path=/usr/local/nginx/tmp/uwsgi \
--http-scgi-temp-path=/usr/local/nginx/tmp/scgi \
--with-mail \
--with-mail_ssl_module \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module \
--with-stream_geoip_module \
--with-stream_ssl_preread_module \
--with-google_perftools_module \
--with-compat \
--with-pcre \
--with-pcre-jit \
--with-libatomic \
--with-debug
컴파일 결과값
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx modules path: "/usr/local/nginx/modules"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error_log"
nginx http access log file: "/usr/local/nginx/logs/access_log"
nginx http client request body temporary files: "/usr/local/nginx/tmp/body"
nginx http proxy temporary files: "/usr/local/nginx/tmp/proxy"
nginx http fastcgi temporary files: "/usr/local/nginx/tmp/fastcgi"
nginx http uwsgi temporary files: "/usr/local/nginx/tmp/uwsgi"
nginx http scgi temporary files: "/usr/local/nginx/tmp/scgi"
make -j && make install
mkdir -p /usr/local/nginx/tmp
chown -R nobody:nobody /usr/local/nginx/tmp
##github를 이용한 nginx 설정
cd /usr/local/src/NPM_Setup
git clone https://github.com/koreanstudy/nginx_source_install_default.git
\mv -f /lib/systemd/system/nginx.service /usr/local/src/nginx.service_backup
\cp -arpf /usr/local/src/NPM_Setup/nginx_source_install_default/nginx.service /lib/systemd/system/nginx.service
systemctl daemon-reload
systemctl enable nginx
\mv -f /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf_ori
\cp -arpf /usr/local/src/NPM_Setup/nginx_source_install_default/nginx.conf_success /usr/local/nginx/conf/nginx.conf
systemctl restart nginx
##NPM 환경변수 설정
echo " " >> /etc/profile
echo "NGINX_HOME=/usr/local/nginx" >> /etc/profile
echo "MySQL_HOME=/usr/local/mysql" >> /etc/profile
echo "PHP_HOME=/usr/local/php" >> /etc/profile
echo " " >> /etc/profile
echo "export PATH="\$"NGINX_HOME/bin:"\$"MySQL_HOME/bin:"\$"PHP_HOME/bin:"\$"PHP_HOME/sbin"\$"{PATH:+:"\$"{PATH}}" >> /etc/profile
echo " " >> /etc/profile
source /etc/profile
'WEB & WAS > Nginx' 카테고리의 다른 글
CentOS 7 Nginx 패키지 설치 및 PHP-FPM 연동 (PHP-FPM 8.2) (0) | 2023.04.09 |
---|---|
Nginx 정리 (0) | 2023.03.12 |
댓글