apt-get方式安装lnmp环境

安装nginxsudo apt-get install nginx安装php和mysqlsudo apt-get install php5-cli php5-cgi php5-curl php5-mysql php5-fpm mysql-server

修改nginx配置文件/etc/nginx/nginx.conf

添加 /etc/nginx/vhost/localhost.conf 文件
server {
        listen 80;
        server_name localhost; #绑定域名
        index index.htm index.html index.php; #默认文件
        root /data/webroot; #网站根目录
        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi_params;
        }
        access_log /data/logs/access.log;
        error_log /data/logs/error.log;
}
server {
        listen 80;
        server_name test.localhost; #绑定域名
        index index.htm index.html index.php; #默认文件
        root /data/webroot/testRoot; #网站根目录
                location ~ \.php$ {
                        fastcgi_pass 127.0.0.1:9000;
                        fastcgi_index index.php;
                        include fastcgi_params;
        }
        access_log /data/logs/test_access.log;
        error_log /data/logs/test_error.log;
}

检查nginx配置

sudo /usr/sbin/nginx -t

重启nginx

sudo /usr/sbin/nginx -s reload

启动php-cgi

php-cgi -b 127.0.0.1:9000
				
时间: 2024-08-07 12:31:59

apt-get方式安装lnmp环境的相关文章

Dockerfile 方式定制 lnmp 环境

现在容器化技术越来越成熟和流行,比传统的虚拟化技术确实是有很大的优势,所以流行是必然的.今天来实践一把,使用Docker的dockerfile方式定制lnmp环境. 环境配置 操作系统:CentOS Linux release 7.6.1810 Docker 版本:19.03.5 Nginx 版本:1.15.5 PHP 版本:7.2.26 MySQL 版本:8.0.18 Redis 版本:5.0.5 创建目录结构 docker目录://docker相关配置 [[email protected]

centos下编译安装LNMP环境

自PHP-5.3.3起,PHP-FPM加入到了PHP核心,编译时加上--enable-fpm即可提供支持. PHP-FPM以守护进程在后台运行,Nginx响应请求后,自行处理静态请求,PHP请求则经过fastcgi_pass交由PHP-FPM处理,处理完毕后返回. Nginx和PHP-FPM的组合,是一种稳定.高效的PHP运行方式,效率要比传统的Apache和mod_php高出不少. 二.依赖环境 yum -y install gcc gcc-c++ make cmake automake au

ubuntu12.04 apt-get安装 lnmp环境(转)

1.安装mysql [sql] view plaincopy sudo apt-get install mysql-server mysql-client 安装过程中要输入root用户的密码. 我在安装中出错,是原来的mysql-cilent mysql-workbench 未完全卸载,将mysql组件完全卸载的方法: 删除mysql前 先删除一下 /var/lib/mysql 还有 /etc/mysql [sql] view plaincopy sudo rm /var/lib/mysql/ 

运维自动化之ansible playbook安装lnmp环境

之前介绍了使用ansible playbok安装zabbix客户端.mysql服务端.nginx,现在介绍一下安装lnmp环境. 下面是安装nginx的信息: nginx_user: www                        nginx用户 nginx_port: 80                         nginx监听端口 nginx_web_dir: /data/webroot/nginx     nginx的目录 nginx_version: 1.4.3      

Centos 6.8编译安装LNMP环境

Centos 6.8编译安装LNMP环境 参考资料: http://www.jb51.net/article/107429.htm https://phperzh.com/articles/1360 一 准备工作 环境介绍: OS:Centos 6.8 最小化安装 Nginx:nginx-1.12.2.tar.gz mysql:mysql-boost-5.7.20.tar.gz php:php-7.2.0.tar.bz2 1.1.关闭SELINUX # 修改配置文件,重启服务后永久生效. sed

CentOS编译安装LNMP环境

这里是教大家如何在centos下利用源码编译安装LNMP环境. 工具/原料 centos服务器一台 自用电脑一台 准备篇 配置好IP.DNS .网关,确保使用远程连接工具能够连接服务器 配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables   #编辑防火墙配置文件 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT(允许80端口通过防火墙) -A INPUT -m state -

cenos6.5源码包安装lnmp环境

虽然centos6可以用yum安装nginx,但是我还是写个教程用源码包安装用于线上环境. 一:在nginx官网下载nginx,并安装 我下载的是nginx-1.6.0 #./configure --prefix=/usr/local/nginx make&& make install 卸载已存在的apache服务和php [[email protected] Desktop]# yum remove httpd php* 安装development Tools [[email prote

CentOS安装LNMP环境的基础组件

注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. 在安装LNMP环境之前,请确保已经使用yum安装了以下各类基础组件(如果系统已自带,还可以考虑yum update下基础组件): gcc cmake openssl+openssl-devel pcre+pcre-devel bzip2+bzip2-devel libcurl+curl+curl-devel libjpeg+libjpeg-devel libpng+libpng-devel freetype+freetype-

Shell脚本一键安装LNMP环境

https://sourceforge.net/projects/opensourcefile/files/ Nginx是一款高性能的HTTP和反向代理服务器.Nginx在反向代理,Rewrite规则,稳定性,静态文件处理,内存消耗等方面表现了很强的优势.因此公司线上和测试环境的WEB服务大多数采用的是LNMP环境,经常要进行LNMP环境的搭建,下面是用SHELL脚本写的一键安装LNMP环境的脚本.1)系统环境介绍Centos 5.8 64位 (已测试)Nginx: nginx-1.4.1.ta