總用root運行太麻煩。注意的是,非root啓動1024如下端口會報錯,須要修改,注意服務。(奇怪,怎麼這裏能夠寫服務,上一篇又不行的?)html
http://nginx.org/packages/centos/7/x86_64/RPMS/nginx
nginx-1.12.1-1.el7.ngx.x86_64.rpm,不下載nginx-1.12.2-1.el7_4.ngx.x86_64.rpmweb
由於須要試試1.12.1是否還會報整數溢出漏洞。ubuntu
radhat或centos存在: /etc/redhat-release 這個文件【 命令 cat /etc/redhat-release 】 ubuntu存在 : /etc/lsb-release 這個文件 【命令 cat /etc/lsb-release 】 debian存在 cat /etc/debian_version 這個文件 Slackware存在 cat /etc/slackware_version 這個文件 參考: http://www.javashuo.com/article/p-ftfraknc-mp.htmlcentos
根據版本選擇下載的rpm包。版本是7,是64位的。app
查看centos版本:webapp
[webapp@pay-app-sever ~]$ uname -a Linux pay-app-sever 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux [webapp@pay-app-sever ~]$ [webapp@pay-app-sever ~]$ cat /etc/issue \S Kernel \r on an \m [webapp@pay-app-sever ~]$ [webapp@pay-app-sever ~]$ cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [webapp@pay-app-sever ~]$ [webapp@pay-app-sever ~]$ cat /proc/version Linux version 3.10.0-327.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Nov 19 22:10:57 UTC 2015 [webapp@pay-app-sever ~]$ [webapp@pay-app-sever ~]$ uname -r 3.10.0-327.el7.x86_64 [webapp@pay-app-sever ~]$ [webapp@pay-app-sever ~]$ file /bin/ls /bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=aa7ff68f13de25936a098016243ce57c3c982e06, stripped [webapp@pay-app-sever ~]$ [webapp@pay-app-sever ~]$ getconf LONG_BIT 64 [webapp@pay-app-sever ~]$ [webapp@pay-app-sever ~]$ getconf WORD_BIT 32 https://blog.csdn.net/shuaigexiaobo/article/details/78030008
須要使用root用戶。測試
[root@pay-app-sever nginx]# rpm -ivh nginx-1.12.1-1.el7.ngx.x86_64.rpm warning: nginx-1.12.1-1.el7.ngx.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY Preparing... ################################# [100%] Updating / installing... 1:nginx-1:1.12.1-1.el7.ngx ################################# [100%] ---------------------------------------------------------------------- Thanks for using nginx! Please find the official documentation for nginx here: * http://nginx.org/en/docs/ Please subscribe to nginx-announce mailing list to get the most important news about nginx: * http://nginx.org/en/support.html Commercial subscriptions for nginx are available on: * http://nginx.com/products/ ---------------------------------
chown webapp /var/log/nginx chown webapp /var/log/nginx/* chown webapp /etc/nginx chown webapp /etc/nginx/* chown webapp /etc/nginx/conf.d/* chown webapp /usr/sbin/nginx chown webapp /var/cache/nginx mkdir /var/run/nginx chown webapp /var/run/nginx vi /etc/nginx/nginx.conf #pid /var/run/nginx.pid; pid /var/run/nginx/nginx.pid; vi /etc/nginx/conf.d/default.conf # listen 80; listen 18010;
[webapp@pay-app-sever ~]$ nginx nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:2 [webapp@pay-app-sever ~]$ [webapp@pay-app-sever ~]$ ps -ef|grep nginx webapp 84434 1 0 11:36 ? 00:00:00 nginx: master process nginx webapp 84435 84434 0 11:36 ? 00:00:00 nginx: worker process