centos+openresty+mariaDB+php搭建web服务器
来源:互联网 发布:数据分析报告怎么写 编辑:程序博客网 时间:2024/04/29 12:05
一。openresty
1.依赖关系
openresty依赖于perl 5.6.1+, libreadline, libpcre, libssl,首先安装依赖关系。
yum install readline-devel pcre-devel openssl-devel gcc
2.下载源码
使用wget下载
wget https://openresty.org/download/ngx_openresty-1.9.7.1.tar.gz
博主安装时最新版为1.9.7.1,可以登录http://openresty.org查看最新版本,选择需要的版本进行下载。
解压下载好的压缩包
tar xzvf ngx_openresty-1.9.7.1.tar.gz
注意将1.9.7.1替换为你下载的版本号
3. ./configure
进入 ngx_openresty-VERSION/ 目录, 然后输入以下命令配置:
./configure
默认, –prefix=/usr/local/openresty 程序会被安装到/usr/local/openresty目录。
我们可以指定各种选项,比如
./configure --prefix=/opt/openresty \
--with-luajit \
--without-http_redis2_module \
--with-http_iconv_module \
--with-http_postgres_module
具体用法参考./configure –help 或者官方文档
4.编译、安装
使用make编译
make
安装
make install
5.将nginx添加到系统变量
PATH=/usr/local/openresty/nginx/sbin:$PATHexport PATH
6.默认项目路径
/usr/local/openresty/nginx/html
7.启动、关闭、重启nginx
nginx -c /usr/local/openresty/nginx/conf/nginx.conf //启动并加载配置文件nginx -s stop //停止nginx -s reload //重启
二。mariaDB
1.安装mariaDB
yum install mariadb mariadb-server net-tools
2.创建系统启动链接
systemctl enable mariadb.servicesystemctl start mariadb.service
3.设置mysql密码
mysql_secure_installation
接下来屏幕会出现一系列代码,代码及操作记录如下
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not foundNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDBSERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we’ll need the currentpassword for the root user. If you’ve just installed MariaDB, andyou haven’t set the root password yet, the password will be blank,so you should just press enter here.Enter current password for root (enter for none):<– 回车OK, successfully used password, moving on…Setting the root password ensures that nobody can log into the MariaDBroot user without the proper authorisation.Set root password? [Y/n] <– y 回车New password: <– 设置用户名为root的mysql密码Re-enter new password: <– 密码确认Password updated successfully!Reloading privilege tables..… Success!By default, a MariaDB installation has an anonymous user, allowing anyoneto log into MariaDB without having to have a user account created forthem. This is intended only for testing, and to make the installationgo a bit smoother. You should remove them before moving into aproduction environment.Remove anonymous users? [Y/n] <– y 回车… Success!Normally, root should only be allowed to connect from ‘localhost’. Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] <– y 回车… Success!By default, MariaDB comes with a database named ‘test’ that anyone canaccess. This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n] <– y 回车- Dropping test database…… Success!- Removing privileges on test database…… Success!Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? [Y/n] <– y 回车… Success!Cleaning up…All done! If you’ve completed all of the above steps, your MariaDBinstallation should now be secure.Thanks for using MariaDB!
至此,mariaDB设置完毕
4.启动方式
systemctl start mariadb.service
三。php
1.安装php及相关模块
yum install php-fpm php-cli php-mysql php-gd php-ldap php-odbc php-pdo php-pecl-memcache php-pear php-mbstring php-xml php-xmlrpc php-mbstring php-snmp php-soap
2.创建启动链接
systemctl enable php-fpm.servicesystemctl start php-fpm.service
3.打开nginx配置中的php
配置文件为/usr/local/openresty/nginx/conf/nginx.conf
将其中php配置项注释去掉
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; }
4.修改nginx的用户
cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.confbak #备份原有配置文件vi /etc/php-fpm.d/www.conf #编辑user = nginx #修改用户为nginxgroup = nginx #修改组为nginx:wq #保存退出
5.启动、重启php-fpm
systemctl start php-fpm.service //启动systemctl restart php-fpm.service //重启systemctl status php-fpm.service //查看状态
0 0
- centos+openresty+mariaDB+php搭建web服务器
- CentOS 7.0搭建LAMP服务器(Apache+PHP+MariaDB)
- CentOS+Nginx+PHP+MySQL 搭建高性能的web服务器
- CentOS 7使用Postfix、Dovecot及MariaDB搭建邮箱服务器
- centOS 7.1.1503 搭建Apache+Mariadb+PHP环境
- CentOS 6.5 搭建PHP环境(Nginx+MariaDB+PHP7)
- CentOS 7.0系统安装配置LAMP服务器(Apache+PHP+MariaDB)
- CentOS 7.0 安装配置LAMP服务器方法(Apache+PHP+MariaDB)
- CentOS 7.0系统安装配置LAMP服务器(Apache+PHP+MariaDB)
- CentOS 7.0安装LAMP服务器(Apache+PHP+Mysql/MariaDB)
- CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB)
- CentOS 7.0系统安装配置LAMP服务器(Apache+PHP+MariaDB)
- CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB)
- CentOS 7.0 安装配置LAMP服务器方法(Apache+PHP+MariaDB)
- CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB)
- CentOS 7.0 安装配置LAMP服务器方法(Apache+PHP+MariaDB)
- CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB)
- centos 7 yum 安装LAMP服务器 Apache PHP MariaDB
- svn 和 git 忽略指定类型的文件
- getWindow().setFlags
- Linq对XML的操作
- 离散--第四章
- 重载与重写
- centos+openresty+mariaDB+php搭建web服务器
- .NET的GridView在后台删除数据
- 二值图像连通体标记
- 挂盐水
- 面程序的功能是将一个4×4的数组进行逆时针旋转90度后输出,要求原始数组的数据随机输入,原新数组以4行4列的方式输出
- Apache配置压缩优化时报错——undefined symbol: inflateEnd
- 判断字符串是否为空格
- 文章标题
- JVM底层又是如何实现synchronized的