컴 파일 설치 설정 nginx 1.6 및 기본 설정 등
:
centos 6.6 【 IP 172.16.3.101】
yum 【 yum , 】
nginx1.6
#
[root@localhost httpd-2.2.29]# yum grouplist | grep -i 'develop'
Additional Development
Development tools
Server Platform Development
Desktop Platform Development
# :
yum groupinstall 'Additional Development' 'Development tools' 'Server Platform Development' 'Desktop Platform Development'
# nginx1.6
, 1.6 ,http://nginx.org/en/download.html
#
tar xf nginx-1.6.2.tar.gz
cd nginx-1.6.2
# nginx nginx , nginx
useradd -r nginx
#
# ./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --user=nginx --group=nginx --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_flv_module --with-http_mp4_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi
--prefix # nginx
--conf-path # nginx
--user # nginx
--group # nginx
--error-log-path #
--http-log-path #
--pid-path # pid
--lock-path #
--with-http_ssl_module # ssl
--with-http_stub_status_module # stub_status_module
--with-http_gzip_static_module # gzip_static_module
--with-http_flv_module #
--with-http_mp4_module # mp4
--http-client-body-temp-path #
--http-proxy-temp-path #
--http-fastcgi-temp-path # FastCGI
make
make install
# PATH
vim /etc/profile.d/nginx.sh
#
export PATH=/usr/local/nginx/sbin:$PATH
# source
. /etc/profile.d/nginx.sh
# nginx
[root@localhost nginx-1.6.2]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] mkdir() "/var/tmp/nginx/client" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed
# OK , nginx ,
#
mkdir -pv /var/tmp/nginx/{client,proxy,fastcgi}
#
[root@localhost nginx-1.6.2]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# OK
# nginx
nginx
# 80
ss -tnl
# nginx
ps aux | grep nginx
nginx SysV init :
# /etc/rc.d/init.d/nginx.conf
vim /etc/rc.d/init.d/nginx.conf
#
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/nginx/nginx.conf"
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
make_dirs() {
# make required directories
user=`nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
options=`$nginx -V 2>&1 | grep 'configure arguments:'`
for opt in $options; do
if [ `echo $opt | grep '.*-temp-path'` ]; then
value=`echo $opt | cut -d "=" -f 2`
if [ ! -d "$value" ]; then
# echo "creating" $value
mkdir -p $value && chown -R $user $value
fi
fi
done
}
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
make_dirs
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
configtest || return $?
stop
sleep 1
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
# ,
NGINX_CONF_FILE="/usr/local/nginx/nginx.conf"
# :
NGINX_CONF_FILE="/etc/nginx/nginx.conf"
#
chmod u+x /etc/nginx/nginx.conf
# chkconfig
root@localhost nginx]# chkconfig --list nginx
service nginx supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add nginx')
[root@localhost nginx]# chkconfig --add nginx
# nginx
service nginx start
# 80
ss -tnl
# , :http://172.16.3.101
# nginx (^_^), , 。
nginx
vim /etc/nginx/nginx.conf
#
# nginx.vim
http://www.vim.org/scripts/script.php?script_id=1886
, ,
# ~/.vim/syntax/, nginx.vim
mkdir ~/.vim/syntax
mv nginx.vim ~/.vim/systax
vim ~/.vim/filetype.vim
#
au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/* if &ft == '' | setfiletype nginx | endif
# /etc/nginx nginx
#
# /etc/nginx/nginx.conf ,
# /etc/nginx/nginx.conf
vim /etc/nginx/nginx.conf
# gg, =, G
# ,
elinks :
#
yum -y install elinks
#
#
elinks http://127.0.0.1/
#
# ,
[root@localhost ~]# elinks -dump http://localhost/
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.
For online documentation and support please refer to [1]nginx.org.
Commercial support is available at [2]nginx.com.
Thank you for using nginx.
References
Visible links
1. http://nginx.org/
2. http://nginx.com/
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
용감한 바로 가기 및 우분투 응용 프로그램안녕하세요 여러분, 이 기사에서는 모든 사이트에서 pwa를 생성하고 실행기 응용 프로그램으로 추가하는 방법을 설명하고 싶습니다. 일부 웹사이트는 PWA로 설치를 허용하지 않지만 유사한 애플리케이션을 원합니다. 1. ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.