Linux服务器的配置、维护、环境搭建和安全配置之三LNPM软件nginx安装
entos7系统库中默认是没有nginx的rpm包的,所以我们自己需要先更新下rpm依赖库
- rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm //安装Nginx的库
- yum install nginx //安装nginx
- systemctl restart nginx.service //启动Nginx服务
配置文件是/etc/nginx/conf.d/default.conf
页面存放位置 /usr/share/nginx/html
//运行php文件时,需要在/etc/nginx/conf.d/default.conf中配置一下.php运行文件
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
运行php文件还需要安装php-fpm服务;
php-fpm安装
4. 安装php-fpm
5. yum install php70w-fpm
6. php-fpm的配置文件在 /etc/php-fpm.d/www.conf
7. systemctl start php-fpm.service //启动php-fpm
**开启php错误提示** vi /etc/php.ini error_reporting = E_ERROR display_errors = On