`
jackroomage
  • 浏览: 1195772 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类

Linux 下 Nginx的安装:(解压,进入目录里面执行,./configure –-> make -> sudo make install)

 
阅读更多

参考文献:

 

http://www.2cto.com/os/201201/117129.html
http://www.cnblogs.com/klobohyz/archive/2011/11/30/2269027.html

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

 

 

Nginx 的安装:(解压,进入目录里面执行, ./configure –-> make -> sudo make install

1、   

    (它的安装过程是,对源代码编译一下,和 jdk 和绿色版的 tomcat 安装有点不一样)。

 

       1.1、再解压 # tar -zxvf xxxx.tar.gz

               然后就安装吧、进入目录里面,只需3步、文件路径设置:--prefix=/web/webserver/nginx
               ./configure  --prefix=/web/webserver/nginx
                make
                make install

1.2 、默认安装在 /usr/local/ 下面。

1.3 、测试是否安装成功,及驱动 nginx 过程。如下:

1.4 、进入, cd /usr/local/nginx/sbin/ 文件夹下。

1.5 、测试是否编译成功 命令是 ,   ./nginx –t  

 

 

1.6 、启动 nginx 命令: ./nginx

1.7 、关掉 nginx 命令:

方法1、# ./nginx -s stop

方法2、擦看进程 #ps -ef|grep nginx    杀死进程   kill -9 进程号。

 

 

 

 

 

Nginx 实战

用途

1 HTTP 服务器

2 反向代理服务器 代理 Tomcat Apache

Windows 安装

常用命令

nginx 或者 nginx.exe 启动

注意有的网页上说是 nginx start 事实上高版本 nginx 没有这个命令了

 

nginx -s stop 强制关闭

nginx -s quit 安全关闭

nginx -s reload 改变配置文件的时候,重启nginx工作进程,来时配置文件生效

nginx -s reopen 打开日志文件

nginx -h 帮助

日志文件 log 目录

FAQ

2011/10/08 13:34:20 [emerg] 9860#8292: CreateFile() "F:\技术资料\我写的代码示例\Ngnix\Windows\nginx-1.0.8/conf/nginx.conf" failed (1113: No mapping for the Unicode character exists in the target multi-byte code page)

不能有中文路径,否则报错

 2011/10/08 13:43:06 [emerg] 10916#13552: unknown directive "

 

 

 

 

 

2、  通过 nginx 代理 加载项目。配置文件的位置( /usr/local/nginx/conf/nginx.conf ):

 

worker_processes  1;

 

events {

    worker_connections  1024;

}

 

 

http {

    include       mime.types;

    default_type  application/octet-stream;

 

 

    #access_log  logs/access.log  main;

 

    sendfile        on;

    #tcp_nopush     on;

 

    #keepalive_timeout  0;

    keepalive_timeout  65;

 

 

    upstream console.g12e.org{

           ip_hash;

           server 192.168.190.17:8090;

    }

#  server 192.168.190.17:8090; 中的 8090 tomcat 的端口号。

    server {

        listen       80;

        server_name  localhost;

 

 

        location / {

            root   html;

            index  index.html index.htm;

        }

 

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   html;

        }

    }

 

 

           #console.g12e.org

       server{

        listen 80;

              server_name console.g12e.org;

        charset utf-8;

        location / {

                proxy_pass  http://console.g12e.org;

                proxy_buffer_size 64k;

                proxy_buffers 4 64k;

                proxy_redirect    off;

                proxy_set_header  Host $host;

                proxy_set_header  X-Real-IP  $remote_addr;

                proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;

        }

      

       error_log logs/error.console.g12e.org.log;

    }

 

}

 

 

 

 

 

Ip: 输出服务器的 ip 地址即可访问 nginx 是否启动成功,它的默认端口是 80

 

参考文献:

 

http://www.2cto.com/os/201201/117129.html
http://www.cnblogs.com/klobohyz/archive/2011/11/30/2269027.html

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

分享到:
评论

相关推荐

    nginx安装教程

    sudo ./configure --sbin-path=/usr/local/nginx/nginx \ --conf-path=/usr/local/nginx/nginx.conf \ --pid-path=/usr/local/nginx/nginx.pid \ --with-http_ssl_module \ --with-pcre=/usr/local/src/pcre-8.41 \ ...

    nginx1.25.3升级openssl-1.1.1w

    ./configure --prefix=/usr/local/nginx-1.25.3 \ --with-openssl=../openssl-1.1.1w \ --with-pcre=../pcre-8.45 \ --with-zlib=../zlib-1.3 \ --with-http_ssl_module \ --without-http_memcached_module \ ...

    pcre-8.12+nginx-1.11.2 在mac os x 10.9.2 安装nginx

    $ sudo ./configure --prefix=/usr/local $ sudo make $ sudo make install 安装Nginx $ tar xvzf nginx-1.11.2.tar $ cd nginx-1.11.2 $ sudo ./configure --prefix=/usr/local/nginx --with-...

    NginxStaticEtags.zip

    Nginx Static Etags 是一个 ..../configure --add-module=/Users/mikewest/Repositories/nginx-static-etags make sudo make install location / {  ...  FileETag on;  ... } 标签:Nginx

    nginx3.46+RTMP_module.rar

    ./configure --prefix=/etc/nginx --add-module=./nginx-rtmp-module Make Make install 检查系统的状态和版本:sudo systemctl status nginx 如果防火墙打开的,需要打开端口 80和443 打开端口命令 :sudo ufw ...

    nginx-http-hsts:Nginx 模块添加适当的 Strict-Transport-Security 标头

    nginx HSTS 模块 ngx_http_hsts 模块为 nginx 中的 HTTP 严格传输安全提供支持。 依赖关系 nginx 1.xx 的来源及其依赖项。...$ make && sudo make install 使用模块的配置配置nginx。 例子 您可以通过将以下行添加到

    基于大数据分析与可视化的疫情信息发布平台源码+项目部署教程.zip

    2.在build目录下utils.js修改,找到如下配置添加publicPath: '../../' ``` if (options.extract) { return ExtractTextPlugin.extract({ use: loaders, fallback: 'vue-style-loader', publicPath: '../../',...

    ffmpeg-liveStreaming

    ffmpeg-liveStreaming 要输出实时流,您需要从源代码安装 nginx 服务器下载wget 解压tar -zxvf nginx-1.7.9.tar.gz下载 RTMP 模块wget 编译NGINX ./configure --with-...master make sudo make install启动服务器默认...

    ngx_http_avatars_gen_module:with使用Nginx即时生成化身

    ./configure --add-module=/path/to/module/avatars_gen make && sudo make install 配置 可以在位置上下文中启用模块: http { server { listen 80 ; server_name localhost; # Default params location /...

    MTS:rtsp拉流转hls直播,本地视频文件切片m3u8

    nginx + ffmpeg rstp转rtmp安装ffmpeg *****************************先安装nasmwget ...-prefix=/usr makesudo make install*****************************缺少libx264库,需要安装该库:wget ...

    nginx-flaxton-logger-module:Nginx 的完整请求记录器模块。 这是http的一部分

    ./configure --add-module=modules/ngx-flaxton-logger make sudo make install 基本上你就完成了! 配置 模块有一些可配置的步骤,只是为了提供更灵活的 Nginx 请求日志记录方式。 #Making on or off the ...

    在Nginx服务器中使用LibreSSL的教程

    本文会介绍一些 Nginx 与 Libressl 一起使用实践...$ ./configure --prefix=/usr LDFLAGS=-lrt && make check && sudo make install 新安装的 LibreSSL 可替代openssl以相同的方式运行,但要注意:正如 sabotage-linux

    php-decrypt:PHP Decrypt是一个跨平台用来解密PHP源码的扩展

    特色 兼容OPcache,Xdebug等其他扩展 兼容Linux,OSX,Windows等系统 兼容Apache,Nginx + php-fpm,命令行等运行模式 ...sudo make install 在Windows上编译 可以自行参考本篇文章: ://learnku.com/artic

    php-sweph:适用于瑞士星历PHP扩展

    git clone https://github.com/cyjoelchen/php-sweph.git cd php-sweph phpize ./configure make sudo make install 将extension=sweph.so添加到php.ini。 就我而言(nginx + php-fpm),它位于/etc/...

    nginx:nginx学习,学习代码,学习思路,学习设计

    nginx nginx学习,学习代码,学习思路,学习设计 1.generate the makefile ./auto/configure --with-cc-opt='-ggdb3 -O0' 2.make 3.sudo make install

    travis-api:Travis CI API

    Travis API 警告!!!!! ... 如果您想为.org部署更改,请使用org-only分支 ...您需要以下软件包才能使travis-api正常工作: ... $ sudo make install $ sudo ln -s /usr/local/nginx/sbin/nginx /bin/nginx 安装 设

Global site tag (gtag.js) - Google Analytics