In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Download all packages, jemalloc (optional) to optimize memory
Yum groups install "Development Tools"-yyum-y install bzip2wget-c ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gzwget-c http://www.openssl.org/source/openssl-1.0.2g.tar.gzwget-c http://www.zlib.net/zlib-1.2.11.tar.gzwget-c http://tengine.taobao.org/download/tengine-2.1.2.tar.gz # wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2tar-zxf pcre-8.40.tar.gz-C / usr/local/src/tar-zxf openssl-1.0.2g.tar.gz-C / usr/local/src/tar-zxf zlib-1.2.11.tar.gz-C / usr/local/src/tar-zxf tengine-2.1.2.tar.gz-C / usr/local/src/#tar jxvf Jemalloc-3.6.0.tar.bz2-C / usr/local/src/
1. Install pcre
Mkdir / usr/local/pcrecd / usr/local/src/pcre-8.40./configure-- prefix=/usr/local/pcremake-jmake install
2. Install openssl
Mkdir / usr/local/opensslcd / usr/local/src/openssl-1.0.2g/./config-- prefix=/usr/local/opensslmake dependmake-jmake install
Vi / etc/profile
Export PATH=$PATH:/usr/local/openssl/binorecho "export PATH=$PATH:/usr/local/openssl/bin" > > / etc/profile
: wq!
Source / etc/profile
3. Install zlib
Mkdir / usr/local/zlibcd / usr/local/src/zlib-1.2.11./configure-- prefix=/usr/local/zlibmake-jmake install
4. Install Nginx
Groupadd wwwuseradd-g www www-s / bin/falsecd / usr/local/src/tengine-2.1.2/# enables jemalloc memory optimization. / configure-- prefix=/usr/local/nginx-- without-http_memcached_module-- user=www-- group=www-- with-http_stub_status_module-- with-http_ssl_module-- with-http_gzip_static_module-- with-openssl=/usr/local/src/openssl-1.0.2g-- with-zlib=/usr/ Local/src/zlib-1.2.11-with-pcre=/usr/local/src/pcre-8.40-with-jemalloc=/usr/local/src/jemalloc-3.6.0makemake install
Note:-- with-openssl=/usr/local/src/openssl-1.0.2g-- with-zlib=/usr/local/src/zlib-1.2.11-- with-pcre=/usr/local/src/pcre-8.40 points to the path of decompression of the source package, not the path of installation, otherwise an error will be reported.
5. Add a boot script
/ usr/local/nginx/sbin/nginx # Boot Nginx Settings nginx boot vi / etc/rc.d/init.d/nginx # Edit the startup file to add the following #! / bin/sh## nginx-this script starts And stops the nginx daemon## chkconfig:-85 "description: Nginx is an HTTP (S) server HTTP (S) reverse\ # proxy and IMAP/POP3 proxy server# processname: nginx# config: / etc/nginx/nginx.conf# config: / usr/local/nginx/conf/nginx.conf# pidfile: / usr/local/nginx/logs/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 0nginx = "/ usr/local/nginx/sbin/nginx" prog=$ (basename $nginx) NGINX_CONF_FILE= "/ usr/local/nginx/conf/nginx.conf" [- f / etc/sysconfig/nginx] & &. / etc/sysconfig/nginxlockfile=/var/lock/subsys/nginxmake_dirs () {# make required directoriesuser= `$nginx-V 2 > & 1 | grep "configure arguments:" | sed's / [^ *] *-user=\ ([^] *\). * /\ 1if [- z "`grep $user / etc/ passwd`"]; thenuseradd-M-s / bin/nologin $userfioptions= `$ nginx-V 2 > & 1 | grep 'configure arguments:' `for opt in $options; doif [`echo $opt | grep'. *-temp-path'`] Thenvalue= `echo $opt | cut-d "="-f 2`if [!-d "$value"] Then# echo "creating" $valuemkdir-p $value & & chown-R $user $valuefifidone} start () {[- x $nginx] | | exit 5 [- f $NGINX_CONF_FILE] | | exit 6make_dirsecho-n $"Starting $prog:" daemon $nginx-c $NGINX_CONF_FILEretval=$?echo [$retval-eq 0] & & touch $lockfilereturn $retval} stop () {echo-n $"Stopping $prog:" killproc $prog-QUITretval=$?echo [$retval-eq 0] & rm-f $lockfilereturn $retval} restart () {# configtest | | return $? stopsleep 1start} reload () {# configtest | | return $? echo-n $"Reloading $prog:" killproc $nginx-HUPRETVAL=$?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" instart) rh_status_q & & exit 0 $1 ; stop) rh_status_q | | exit 0 $1x restart | configtest) $1 * reload) rh_status_q | | exit 7 $1 * force_reload;;status) rh_status;;condrestart | try-restart) restart | | exit 0 *) echo $"Usage: $0 {start | stop | status | restart | condrestart | try-restart | reload | force-reload | configtest}" exit 2esac###:wq! # Save and exit chmod 775 / etc/rc.d/init.d/nginx # give file execution permission chkconfig nginx on # set boot / etc/rc.d/init.d/nginx restart # restart the program
Open the server IP address in the browser and you will see the following interface, indicating that Nginx has been installed successfully.
Attached. / configure detection configuration result
# Configuration summary + using PCRE library: / usr/local/src/pcre-8.40 + using OpenSSL library: / usr/local/src/openssl-1.1.0e + md5: using OpenSSL library + sha1: using OpenSSL library + using zlib library: / usr/local/src/zlib-1.2.11 + jemalloc library is disabled # this is a configuration that I did not add jemalloc memory optimization before This is just an example reference nginx path prefix: "/ usr/local/nginx" nginx binary file: "/ usr/local/nginx/sbin/nginx" 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: "client_body_temp" nginx dso module path: "/ usr/local/nginx/modules/" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"
Extended reading:
The method of directly downloading txt, pdf, doc, xls and other files in Nginx configuration
Add the following code to the nginx configuration file
Location / {
If ($request_filename ~ * ^. *?\. (txt | pdf | doc | xls) $) {
Add_header Content-Disposition: 'paired wayward admittance'
}
}
Reference:
Http://www.osyunwei.com/archives/10057.html
Http://blog.csdn.net/elong490/article/details/54913193
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.