Nginx安装配置
2019-01-18 本文已影响0人
by丶无名
下载安装包 && 安装 依赖包
# wget http://nginx.org/download/nginx-1.14.2.tar.gz
# yum install pcre-devel gcc-c++ openssl-devel libxslt-devel wget
解压,编译安装
# tar xf nginx-1.14.2.tar.gz
# cd nginx-1.14.2/
# ./configure --prefix=/usr/local/nginx --without-select_module --without-poll_module --with-debug --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_xslt_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-cc=`which gcc`
# make && make install
修改配置文件
# vim /usr/local/nginx/conf/nginx.conf.default
# egrep -v "^$| *#" /usr/local/nginx/conf/nginx.conf.default
...
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
root /var/zabbix/php;
location / {
root /var/zabbix/php;
index index.html index.php index.htm;
}
location ~\.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
...
}
# cd /usr/local/nginx/
起服务
# sbin/nginx -c conf/nginx.conf.default
安装 php
# yum install php php-fpm php-mysql php-devel php-mbstring php-pecl php-xmlrpc php-snmp php-bcmath php-xml php-gd php-ldap -y
/etc/php.ini 添加如下
# vim /etc/php.ini
post_max_size =16M
max_execution_time =300
max_input_time =300
date.timezone = PRC
--------------------
起服务
# systemctl start php-fpm zabbix_server zabbix_agentd