首次接触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
sudo wget http://zlib.net/zlib-1.2.8.tar.gz
./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/
/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://www.linuxidc.com/Linux/2013-09/89768.htm
http://jingyan.baidu.com/article/2fb0ba404f814e00f2ec5f9e.html
http://blog.csdn.net/ihelloworld/article/details/7029796