nginx安装
1.官网: http://nginx.org 2.安装: #yum install gcc gcc-c++ autoconf make 如果这些依赖工具没安装则执行 在Debian/Ubuntu系统下: apt-get update apt-get install nginx libpcre3 libpcre3-dev openssl openssl-dev 在 Redhat/Fedora/centos系统下: yum -y install make zlib zlib-devel gcc-c++ libtool pcre pcre-devel openssl openssl-devel nginx 源码安装: wget http://nginx.org/download/nginx-1.12.2.tar.gz tar -zxvf nginx-1.12.2.tar.gz cd nginx-1.12.2 ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/logs/nginx.pid --with-http_ssl_module --with-http_stub_status_module make && sudo make install 3. 启动服务: /usr/local/nginx/sbin/nginx 重启: /usr/local/nginx/sbin/nginx -s reload 停服: /usr/local/nginx/sbin/nginx -s stop 测试nginx配置文件是否正确: /usr/local/nginx/sbin/nginx -t 4. 查看服务是否启动: ps aux | grep nginx netstat -antulp|grep 80 lsof -i :80 5. 打开浏览器,访问 http://localhost
nginx各种配置
待整理...敬请期待!
nginx常见问题
1. nginx返回 413 Request Entity Too Large 错误 原因:nginx限制了上传文件的大小 解决办法:修改nginx.conf ,在http{}段内设置client_max_body_size 10m; 如果后端是php,则再把php。ini配置修改 post_max_size = 8M upload_max_filesize = 6M php.ini中设置大小关系: memory_limit > post_max_size > upload_max_filesize
linux、unix系列系统下常用安装方法总结
1. 源码编译方式安装: ./configure 、make、sudo make install 2. 使用包管理工具安装: 如yum、dnf、apt-get、dpkg、brew、port 等 3. 使用rpm命令安装: rpm -ivh rpm包文件名