ngnix 搭建


首次接触ngnix  http 将所做的内容记录一下

1. 下载所需要资源,我是下载到/home/code/Documents/webserver/ 目录下

1)openssl 
./config --prefix=/usr/local/openssl
make 
sudo make install

2.pcre
http://nchc.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.tar.gz
./configure
make
sudo make install

3. zlib
./configure
make
sudo make install

4.ngnix
http://nginx.org/download/nginx-1.9.1.tar.gz
./configure --prefix=/usr/local/nginx --with-pcre=/home/code/Documents/webserver/pcre-8.10 --with-zlib=/home/code/Documents/webserver/zlib-1.2.8 --with-openssl=/home/code/Documents/webserver/openssl-1.0.0e --with-http_stub_status_module --with-http_ssl_module


3.编译之后运行 ;

/sbin/ngnix ;


4.简单修改配置文件:

conf/nginx.conf

server {
        listen       8085;    // 端口号 
        server_name  localhost;  本机IP 

        #charset koi8-r;
        #access_log  logs/host.access.log  main;

        location / {
            root   html;  //存放文件的目录
            index  index.html index.htm;
        }


5.网页访问  :(这里说明遇到的问题,一定要加端口号)


查看本机IP 比如  192.168.192.128

http:// 192.168.192.128:8085/ 

提示 下面内容证明访问成功;

Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.


6.怎么访问文件 :
比如我在html 的目录下放video.mp4  
访问的时候直接 输入: http://192.168.192.128:8060/video.mp4  即可 ;

就可以直接访问网页播放视频
如果建立子目录的话,在html下建立audio ,防止文件即可;
http://192.168.192.128:8060/audio/libai.mp3;

以上仅供参考,个人学习使用;

参考:
http://www.2cto.com/os/201406/310462.html
http://www.linuxidc.com/Linux/2013-09/89768.htm
http://jingyan.baidu.com/article/2fb0ba404f814e00f2ec5f9e.html
http://blog.csdn.net/ihelloworld/article/details/7029796




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值