centos7 nginx+php7yum安装
centos7 nginx+php7yum安装。
一.安装nginx
1.安装yum源
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2.安装nginx
yum install -y nginx
3.启动nginx并设置开机自动运行
- systemctl start nginx #启动,restart-重启,stop-停止
- systemctl enable nginx #开机启动
4.查看版本及运行状态
- nginx -v #查看版本
- ps -ef | grep nginx #查看运行状态
二.安装php7
1.安装yum源
- rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
- rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2.查看php7 yum组件,示例安装php7.2
- yum search php72w
3.选择自己需要的组件安装,php72w.x86_64 和 php72w-fpm.x86_64 为核心程序必装
yum install php72w.x86_64 php72w-fpm.x86_64 php72w-cli.x86_64 php72w-common.x86_64 php72w-gd.x86_64 php72w-ldap.x86_64 php72w-mbstring.x86_64 php72w-mcrypt.x86_64 php72w-mysql.x86_64 php72w-pdo.x86_64 php72w-pecl-redis.x86_64
4.启动php并设为开机启动
- systemctl start php-fpm #启动,restart-重启,stop-停止
- systemctl enable php-fpm #开机启动
5.查看版本及运行状态
- php-fpm -v #查看版本
- ps -ef | grep php-fpm #查看运行状态
进行完以上步骤之后,读者自行在nginx中配置web目录,已经可以正常运行了,但是此时nginx和php是以root身份运行,以最高权限运行web文件会给系统带来安全隐患,以下为权限配置示例
三.修改nginx配置
vi /etc/nginx/conf.d/default.conf
- 找到第一个location中的这一行
index index.html index.htm;
修改为:
index index.php index.html index.htm; #添加index.php
2.
把FastCGI server这行下面的location的注释去掉,并修改成下面这样子
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html; #网站根目录
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
service nginx restart #重启nginx
service php-fpm start #开启php-fpm
3.
在网站根目录新建index.php文件
vim /usr/share/nginx/html/index.php
4.
输入内容:
<?php
phpinfo();
5.
在浏览器中输入虚拟机ip,已经可以看到phpinfo的信息了
在windows上修改hosts文件,添加一行
192.168.6.114 www.test1.com #配置虚拟机ip对应域名
6.
现在就可以在windows上用www.test1.com访问虚拟机配置的服务器了
centos7 nginx+php7yum安装的更多相关文章
- Centos7:nginx的安装,配置及使用
安装依赖 yum install gcc-c++//gcc环境 yum install -y pcre pcre-devel//PCRE:nginx的http模块使用pcre来解析正则表达式 yum ...
- centos7 - nginx配置安装phpmyadmin
原文 https://www.linuxidc.com/Linux/2017-10/147556.htm 使用Nginx搭建phpMyAdmin Nginx有什么用? Nginx可读作Engin ...
- Linux centos7 nginx 的安装
2021-08-18 1. 环境 # 操作系统[root@test007 /]# uname -aLinux test007 3.10.0-862.el7.x86_64 #1 SMP Fri Apr ...
- Linux centos7环境下安装Nginx
Linux centos7环境下安装Nginx的步骤详解 1. 首先到Nginx官网下载Nginx安装包 http://nginx.org/download/nginx-1.5.9.tar.gz ...
- (转)Centos7 Nginx安装
场景:工作中使用的suse,因为系统可可查资料太少,且系统中一些功能的确实,导致很多集群中功能无法顺利测试通过,在Centos上面进行测试,能够更快的熟悉项目的架构过程! 1 安装准备 首先由于ngi ...
- centos7通过yum安装nginx
centos7通过yum安装nginx nginx不支持centos7通过yum直接安装~~~ 1.查看操作系统位数[root@-jenkins ~]# rpm -aq|grep centos-rel ...
- linux(centos7) nginx php mysql安装
环境: linux:centos7 php:7.0 基础命令 // yum install -y lrzsz // centos7 默认已安装yum install epel-release ngin ...
- centos7 下 yum 安装Nginx
centos7 下 yum 安装和配置 Nginx 添加yum源 Nginx不在默认的yum源中,可以使用epel或者官网的yum源,这里使用官网的yum源 rpm -ivh http://nginx ...
- CentOS7离线安装Nginx(详细安装过程)
CentOS7离线安装Nginx(详细安装过程) 1.安装gcc.g++ 下载好所需的文件后上传至服务器(下载地址:https://download.csdn.net/download/a729360 ...
- CentOS7 nginx安装与卸载
简明清晰,易操作,参照: CentOS7 nginx安装与卸载
随机推荐
- axios传递参数的使用
今天在学习elasticsearch时,遇到一个问题:项目中前端采用的是Vue2+axios,后端的接口采用Restful风格来接收: 关于Resultful风格: 1. GET(SELECT):从服 ...
- 【SQL】 牛客网SQL训练Part3 较难难度
获取当前薪水第二多的员工的emp_no以及其对应的薪水salary 请你查找薪水排名第二多的员工编号emp_no.薪水salary.last_name以及first_name,不能使用order by ...
- 【Spring-Cloud】Nacos2.0.3 单系统集群部署问题汇总
1.强制要求JDK8版本 且 64位 C:\Users\Administrator\Desktop\Nacos-Server\Nacos-2.0.3-8848\bin>java -version ...
- 【Uni-App】API笔记 P2
8.路由,跳转 一.保留当前页面并跳转到指定页面 使用uni.navigateBack可以返回到原页面. uni.navigateTo(OBJECT) OBJECT参数说明 参数 类型 必填 默认值 ...
- NVIDIA机器人仿真环境 —— NVIDIA Isaac Sim 的headless模式/无头模式 —— 非桌面模式、非可视化模式
相关: https://developer.nvidia.com/isaac-sim 可视化模式,也就是在桌面系统上直接安装软件,具体地址: https://developer.nvidia.com/ ...
- 为什么模具设计人员中很多人不喜欢使用CAE仿真软件呢? —— 以汽车制造领域为例
参考论文: 通常 的有限元分析软件在后处理 上只是将计算结果 以图形或表格的 方式显 示 在屏幕上 , 并没有对计算结果进行系统的整理 和提炼 . 在基于有 限元 计算结果 的反复设计过程 中, 设计 ...
- AI4Science 再填新成员:谷歌推出天气模型MetNet-3 已落地相关产品、谷歌天气预报模型GraphCast登刊Science —— AI天气预报大模型
相关: https://zhidx.com/news/40169.html https://zhidx.com/news/40290.html PS. 要知道,华为公司的最高学术成果就是AI天气预报, ...
- 使用MindSpore_hub 进行 加载模型用于推理或迁移学习
从官方资料: https://www.mindspore.cn/tutorial/training/zh-CN/r1.2/use/save_model.html?highlight=save_chec ...
- Ubuntu18.04 server 双网卡,一个设置为静态IP, 一个设置为动态IP
操作目的如题: 修改网络配置文件: sudo vim /etc/netplan/50-cloud-init.yaml 修改内容如下: # This file is generated from inf ...
- 在线flex布局----自己写的一个flex布局的小玩意,需要的私聊加关注0.0