当前位置:首页 > 教程 > 正文内容

nginx安装学习(nginx安装教程)

2023-04-19 01:10:07教程1

nginx安装教程

  ngx_upload模块是nginx中一个文件上传模式了,下面我们来看看nginx安装文件上传ngx_upload模块步骤,希望例子对各位有帮助.

  安装nginx,并加入nginx upload module和nginx cache purge module:

  mkdir ~/download

  cd ~/download

  wget http://www.grid.net.ru/nginx/download/nginx_upload_module-2.0.12.tar.gz

  tar zxf nginx_upload_module-2.0.12.tar.gz

  git clone https://github.com/FRiCKLE/ngx_cache_purge.git

  yum groupinstall "Development Tools"

  yum install pcre-devel zlib-devel openssl-devel

  wget http://nginx.org/download/nginx-1.2.3.tar.gz

  tar zxf nginx-1.2.3.tar.gz

  cd nginx-1.2.3

  ./configure --prefix=/usr/local/nginx --with-pcre --with-http_ssl_module --add-module=../nginx_upload_module-2.0.12 --add-module=../ngx_cache_purge

  make && make install

  尝试启动:

  /usr/local/nginx/sbin/nginx

  ps aux | grep nginx

  假如我的网站是放在 /home/mysite/www 下的,而nginx配置文件就放在 /home/mysite/etc 下:

  省略了很多内容的配置文件,mysite.conf:

  server {

  listen 80;

  server_name 192.168.1.123;

  client_max_body_size 20M;

  location /upload {

  include /home/mysite/etc/nginx/ngx_upload.conf;

  }

  ....其他的配置....

  location @after_upload {

  proxy_pass http://www_backend;

  }

  }

  将nginx_upload.conf独立开来,是因为其他网站也可以包含此上传配置文件:

  nginx_upload.conf:

  upload_pass @after_upload;

  upload_pass_args on;

  upload_cleanup 400 404 499 500-505;

  upload_store /home/mysite/www/uploads/tmp;

  upload_store_access user:r;

  upload_limit_rate 128k;

  upload_set_form_field "${upload_field_name}_name" $upload_file_name;

  upload_set_form_field "${upload_field_name}_content_type" $upload_content_type;

  upload_set_form_field "${upload_field_name}_path" $upload_tmp_path;

  upload_aggregate_form_field "${upload_field_name}_md5" $upload_file_md5;

  upload_aggregate_form_field "${upload_field_name}_size" $upload_file_size;

  upload_pass_form_field "^.*$";

  而最后那个参数:upload_pass_form_field,代表可以将表单的所有参数保持原样传递到后端,需要区分文件保存类型时很有用。

nginx安装方式

不需要

nginx不需要安装jdk,但是要安装pcre的正则表达式支持的插件,因为nginx里面可以使用正则。

nginx安装教程linux没有./configure命令

2.\Enter,反斜杠后面紧跟回车,表示下一行是当前行的续航。

./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.21 \

--with-zlib=/usr/local/src/zlib-1.2.8 \

--with-openssl=/usr/local/src/openssl-1.0.1c

nginx1.12安装

https配置步骤:

1、申请SSL证书;

2、在Nginx服务器上面安装SSL证书:

(1)将证书文件(.crt文件)放到指定目录下,例如:/usr/local/nginx/conf/cert

(2)将私钥文件(.key文件)放到指定目录,例如/usr/local/nginx/conf/ssl

(3)若为CA机构签发证书,需要将中间证书文件放到指定目录下,例如/usr/local/nginx/conf/certs

3、修改Nginx配置文件:

(1)打开/etc/nginx/nginx.conf文件

(2)在http部分增加如下配置

ssl on;

ssl_certificate /usr/local/nginx/conf/cert/xxx.crt;

ssl_certificate_key /usr/local/nginx/conf/ssl/xxx.key;

ssl_session_cache shared:SSL:1m;

ssl_session_timeout 5m;

(3)如果是CA证书,还需要增加配置

ssl_client_certificate /usr/local/nginx/conf/certs/xxx.crt;

4、重新加载Nginx配置文件:nginx -s reload

5、测试配置是否正确:

(1)curl -k https://www.xxx.com (测试https是否正常)

(2)openssl s_client -connect www.xxx.com:443 (检查ssl证书是否安装正确)

nginx 安装

启动失败的解决办法:Nginx 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器。Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点开发的,第一个公开版本0.1.0发布于2004年10月4日。特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好。

nginx安装教程linux

学会Linux基本操作,高级点的还有Linux管理员操作,查看进程资源使用,设置资源限制等;

学会服务器配置,如Nginx或apache等;

以上两点是关于网站搭建和运维,这假设你已经有现成的网站代码。如果需要自己实现网站的话,首先需要根据自己熟悉的编程语言选择合适的Web框架或技术,主流的有Java: Servlet + JSP,高级点的还有SSH之类的, Python: Django, Ruby : Ruby on Rails, C#:

http://ASP.Net

,高级点的可以和MVC一起用。此外还有数据库的操作访问,前端的还有Javascript, CSS等。

本网站文章仅供交流学习 ,不作为商用, 版权归属原作者,部分文章推送时未能及时与原作者取得联系,若来源标注错误或侵犯到您的权益烦请告知,我们将立即删除.

本文链接:https://www.xibujisuan.cn/98785329.html