毕业设计那点事 — 源码安装Nginx
2017-05-07 15:52
246 查看
为Nginx创建用户组
安装Nginx依赖包
下载nginx
开启对应模块并安装
修改配置(了解Nginx配置可看下一篇文章)
开启服务
nginx服务操作
参考链接: link1 | link2 | link3 | link4
sudo groupadd nginx sudo useradd -g nginx -M nginx
安装Nginx依赖包
- pcre sudo apt-get install libpcre3 libpcre3-dev - zlib sudo apt-get install zlib1g zlib1g-dev - openssl sudo apt-get install openssl libssl-dev sudo apt-get install libgeoip sudo apt-get install libgd sudo 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_module sudo make && make install
修改配置(了解Nginx配置可看下一篇文章)
sudo vim /usr/local/nginx/conf/nginx.conf //在http模块内添加server server { 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-fpm sudo /etc/init.d/php-fpm start sudo /usr/local/nginx/sbin/nginx //通过访问 yaf.com 查看结果,需要修改hosts文件 sudo vim /etc/hosts 127.0.0.1 yaf.com
nginx服务操作
/usr/local/nginx/sbin/nginx nginx -s stop 立即停止 nginx -s quit 温和停止守护进程 nginx -s reopen 重新打开日志文件 nginx -s reload 重新载入配置文件 killall nginx nginx -t 检测配置文件
参考链接: link1 | link2 | link3 | link4
相关文章推荐
- 毕业设计那点事 — 源码安装Mysql
- 毕业设计那点事 — 源码安装PHP7
- LNMP(linux+nginx+mysql+php)源码安装及协调配置测试笔记
- 从源码安装nginx
- nginx-1.8.1源码安装
- ubuntu 源码安装 nginx
- Nginx源码安装及调优配置(二)
- centos下源码安装Nginx详细操作步骤和方法
- Centos6.5源码编译安装nginx
- nginx-1.6.2.tar.gz 源码安装
- 源码安装nginx、mysql的注意事项
- php5.6源码安装及php-fpm配置与nginx集成
- 源码安装 php+nginx 构建BBS平台 (以CentOS6为例)
- 源码编译安装 apache, nginx, axel
- Nginx学习(1):Nginx源码安装
- linux centos源码编译安装Nginx和PHP
- nginx源码安装
- 构建LANMP架构二:源码安装nginx及简单应用
- Centos7 在线源码安装Nginx
- 源码编译安装Nginx服务