澳门在线威尼斯官方 > 电脑操作 > linux环境搭建lnmp环境,Centos7环境搭建lnmp环境

原标题:linux环境搭建lnmp环境,Centos7环境搭建lnmp环境

浏览次数:185 时间:2019-11-06

[原创]编译安装lnmp环境

准备软件:nginx1.10.3+php-5.5.12+mariadb10.0.8(数据库在此使用的yum安装)

mariadb10.0.8数据库的编译安装地址:

依赖包均已yum在线安装

linux环境搭建lnmp环境,linux搭建lnmp

[原创]编译安装lnmp环境准备软件:nginx1.10.3+php-5.5.12+mariadb10.0.8(数据库在此使用的yum安装)

如果需要编译安装的可以给我留言,我后续再发布出来! 

依赖包均已yum在线安装一、yum安装mariadb数据库yum -y install mariadb*启动数据库systemctl start mariadb修改root密码grant all privileges on *.* to 'root'@'localhost' identified by "root" with grant option;grant all privileges on *.* to 'root'@'%' identified by "root" with grant option;flush privileges;二、安装nginx1、安装依赖包yum install -y pcre pcre-devel openssl openssl-devel gcc-c++2、创建运行进程的用户groupadd nginxuseradd -g nginx -s /bin/nologin nginx3、编译安装nginx我在这儿的软件都放在myapp目录下的tar -zxvf nginx-1.10.3.tar.gz #解压到当前目录cd nginx-1.10.3./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-pcre --with-http_gzip_static_module --without-http_gzip_module --with-http_stub_status_modulemakemake install4、启动nginxcd /usr/local/nginx/sbin./nginx5、验证:浏览器访问 -y install libxml2* curl curl-devel libpng-devel libpng openldap openldap-devel freetype freetype-devel libjpeg-devel libpng-devel2、编译安装phptar -xjf php-5.5.12.tar.bz2cd php-5.5.12./configure^C-prefix=/usr/local/php --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local/ --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64makemake testmake install3、修改php文件cp /myapp/php-5.5.12/php.ini-production /usr/local/php/etc/php.inicp /usr/local/php/etc/php-fpm.conf.default php-fpm.conf4、启动php/usr/local/php/sbin/php-fpm检查启动是否成功netstat -lntp | grep php-fpm显示 tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 77087/php-fpm: mast四、整合nginx支持php1、修改nginx配置文件vi /usr/local/nginx/conf/nginx.conf[[email protected] conf]# cat nginx.conf | grep -v "#"user nginx nginx;worker_processes 1;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr

  • $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; charset utf8; location / { root html; index index.html index.htm index.php; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ .php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }2、创建index.php文件测试cd /usr/local/nginx/htmlvi index.php[[email protected] html]# cat index.php <?php $link=mysql_connect("172.16.20.112","root","root"); if(!$link) echo "MySQL数据库连接失败!!"; else echo "MySQL数据库连接成功!!"; phpinfo();?> 保存退出chmod 775 index.php3、验证浏览器

有问题大家请指出来!!谢谢!! 

[原创]编译安装lnmp环境 准备软件:nginx1.10.3+php-5.5.12+mariadb10.0.8(数据库在此使用的yum安装) 如果需要编...

一、yum安装mariadb数据库
yum -y install mariadb*
启动数据库
systemctl start mariadb
修改root密码
grant all privileges on *.* to 'root'@'localhost' identified by "root" with grant option;
grant all privileges on *.* to 'root'@'%' identified by "root" with grant option;
flush privileges;
二、编译安装nginx
1、安装依赖包
yum install -y pcre pcre-devel openssl openssl-devel gcc-c++
2、创建运行进程的用户
groupadd nginx
useradd -g nginx -s /bin/nologin nginx
3、编译安装nginx
我在这儿的软件都放在myapp目录下的
tar -zxvf nginx-1.10.3.tar.gz #解压到当前目录
cd nginx-1.10.3
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-pcre --with-http_gzip_static_module --without-http_gzip_module --with-http_stub_status_module
make
make install
4、启动nginx
cd /usr/local/nginx/sbin
./nginx
5、验证:浏览器访问http://ip

本文由澳门在线威尼斯官方发布于电脑操作,转载请注明出处:linux环境搭建lnmp环境,Centos7环境搭建lnmp环境

关键词:

上一篇:没有了

下一篇:没有了