毕业设计那点事 — 源码安装Nginx
来源:互联网 发布:淘宝 手办时光机 编辑:程序博客网 时间:2024/05/22 01:33
- 为Nginx创建用户组
sudo groupadd nginxsudo useradd -g nginx -M nginx
- 安装Nginx依赖包
- pcresudo apt-get install libpcre3 libpcre3-dev- zlibsudo apt-get install zlib1g zlib1g-dev- opensslsudo apt-get install openssl libssl-devsudo apt-get install libgeoipsudo apt-get install libgdsudo apt-get install libxml2 libxslt
- 下载nginx
tar zxvf nginx.tar.gz //下载的对应nginx版本
- 开启对应模块并安装
cd nginx./configure --user=bee --group=bee --with-http_ssl_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_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_modulesudo make && make install
- 修改配置(了解Nginx配置可看下一篇文章)
sudo vim /usr/local/nginx/conf/nginx.conf//在http模块内添加serverserver { listen 8000; # 监听端口 server_name yaf.com; # 域名 root /home/app/yaf/demo/yafApp; #网站目录 index index.php index.html; #默认读取文件,入口文件 location / { try_files $uri $uri/ /index.php$is_args$args; } #使用php-fpm处理php请求 location ~ \.php$ { try_files $uri =404; include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; } }//以下为个人nginx.conf配置文件 user nginx nginx;worker_processes 4;worker_priority 0;error_log logs/error.log;events { worker_connections 1024; accept_mutex on; accept_mutex_delay 500ms;}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 8000; server_name yaf.com; # alias another.alias; root /home/app/yaf/demo/yafApp; index index.php index.html; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { try_files $uri =404; include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; } }}
- 开启服务
//由于是与php-fpm配合使用,需要在开启nginx服务之前开启php-fpm服务,上篇文章已介绍php-fpmsudo /etc/init.d/php-fpm startsudo /usr/local/nginx/sbin/nginx//通过访问 yaf.com 查看结果,需要修改hosts文件sudo vim /etc/hosts127.0.0.1 yaf.com
- nginx服务操作
/usr/local/nginx/sbin/nginxnginx -s stop 立即停止nginx -s quit 温和停止守护进程nginx -s reopen 重新打开日志文件nginx -s reload 重新载入配置文件killall nginxnginx -t 检测配置文件
参考链接: link1 | link2 | link3 | link4
0 0
- 毕业设计那点事 — 源码安装Nginx
- 毕业设计那点事 — 源码安装PHP7
- 毕业设计那点事 — 源码安装Mysql
- 毕业设计那点事
- 毕业设计那点事
- 毕业设计那回事
- nginx的负载均衡那点事
- nginx php-fpm segfault那点事
- nginx那些年、那点事
- 系统安装那点事~
- ubuntu安装后设置那点事
- 关于vue.js安装那点事
- 关于Nginx配置文件及ReWriteUrl那点事~
- Nginx的负载均衡的那点事
- Nginx的负载均衡的那点事
- Nginx的负载均衡的那点事
- Nginx的负载均衡的那点事
- Nginx的负载均衡的那点事
- JPA学习记录四(了解部分注解并搭建出多类型的数据字段)
- SumblimeText 3 + NodeJS环境配置 [重启自动杀进程(kill)]
- Java并发编程:volatile关键字解析
- Kafka-[3]-KafkaStream
- Automatic Judge
- 毕业设计那点事 — 源码安装Nginx
- paint 中的方法
- python操作txt
- Linux修改时间
- 决策树Python实现
- Hibernate Validator实现数据校验
- Java web 重定位失效
- oracle基本命令集合(1)--基本操作
- Android中Button的响应点击事件的几种写法