Linux上安装nginx
来源:互联网 发布:淘宝网平板电脑版下载 编辑:程序博客网 时间:2024/06/07 20:08
如果迩是在ubuntun下安装nginx、建议先卸载掉自带的版本、太旧了
sudo apt-get --purge remove nginx
首先去找个源码吧、目前官网的最新稳定版是1.2.6、所以输入个
wget http://nginx.org/download/nginx-1.2.6.tar.gz
获取到当前目录、然后再解压啪啪的tar -zxf xxxx.tar.gz
然后就安装吧、从源码安装三步曲如果没有意外的话是狠顺利的、
./configure
make
sudo make install
先执行./configure后别急着往下执行、看看配置不是有有错了、如果不看清楚的话、执行make肯定会出问题、如果迩在make的时候看到出现
make: *** No rule to make target `build', needed by `default'. Stop.这种现象、迩回头看看./configure的出错信息是不是没装某个组件、比如没装
伪静态模块需要pcre库、这是相常见的问题、没装就装上吧、目前pcre最新版本为8.12、如果迩想下载的话最好选择tar.gz的、当然官网也提供了压缩率更高的
ubuntu安装nginx时提示error: the HTTP rewrite module requires the PCRE library
需要安装pcre包。
sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev
你可能还需要安装
sudo apt-get install openssl libssl-dev
启动nginx
/usr/local/nginx/sbin/nginx
Nginx反向代理设置 从80端口转向其他端口
找到conf/nginx.conf文件,编辑:
worker_processes 1;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name 127.0.0.1:8080; location / { proxy_pass http://127.0.0.1:8080; } }}
server下的结点:
listen:监听80端口
server_name:转发到哪个地址
proxy_pass:代理到哪个地址
nginx常用命令(要进入到nginx的目录):
开启:start nginx
重启:nginx -s reload
server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://localhost:8080; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; }
阅读全文
0 0
- Linux上安装Nginx
- Linux上安装Nginx
- linux上安装nginx
- linux上安装nginx
- linux上安装nginx
- linux上安装nginx
- Linux上安装nginx
- Linux服务器上安装nginx
- linux上的nginx安装
- 在linux上安装nginx
- 9、linux上安装nginx
- 在linux上安装nginx
- Linux系统上安装nginx
- linux上Nginx安装步骤
- 在Linux上安装Nginx
- [nginx+linux] centos上安装nginx
- linux 上nginx php 编译安装
- Nginx+mysql+php 在linux上安装
- Kibana的安装和使用
- execute
- MySQL 使用concat函数拼接字段
- STM32内存之四(CCM)
- Java-线程池 ThreadPool 专题详解 (美团面试题)
- Linux上安装nginx
- 真的好累
- Week04_day04 线程
- SQL 按年,月,日对数据进行分组
- Array.prototype.remove=function(element){}
- Android之在eclipse编译项目出现unable to resolve target android-20解决办法
- 蓝桥杯 算法训练 关联矩阵
- leetcode 153[medium]---Find Minimum in Rotated Sorted Array
- 82. Remove Duplicates from Sorted List II