当前位置: 首页 > news >正文

珠海移动网站建设报价新手建设html5网站

珠海移动网站建设报价,新手建设html5网站,百度一下手机版,如何更改网站备案信息文章目录 一、环境信息二、LNMP环境搭建2.1 准备编译环境2.2 nginx安装2.3 mysql安装2.4 php安装2.5 nginx配置2.6 mysql配置2.7 配置php 三、常见问题3.1 安装其它版本的nginx服务3.2 php版本过低 一、环境信息 操作系统#xff1a;公共镜像CentOS 7.8 64位 本文的部署配置… 文章目录 一、环境信息二、LNMP环境搭建2.1 准备编译环境2.2 nginx安装2.3 mysql安装2.4 php安装2.5 nginx配置2.6 mysql配置2.7 配置php 三、常见问题3.1 安装其它版本的nginx服务3.2 php版本过低 一、环境信息 操作系统公共镜像CentOS 7.8 64位 本文的部署配置中服务版本如下如果需要其它版本需要另行安装配置。 Nginx版本Nginx 1.20.1 MySQL版本MySQL 5.7.36 PHP版本PHP 7.0.33二、LNMP环境搭建 2.1 准备编译环境 关闭防火墙 运行 systemctl status firewalld 命令查看当前防火墙的状态 如果防火墙的状态参数是inactive则防火墙为关闭状态如果防火墙的状态参数是active则防火墙为开启状态。 # 临时关闭 systemctl stop firewalld# 禁止开机自启 systemctl disable firewalld关闭SELinux 运行 getenforce 命令查看SELinux的当前状态。 如果SELinux状态参数是Disabled则SELinux为关闭状态如果SELinux状态参数是Enforcing则SELinux为开启状态。 # 临时关闭 setenforce 0# 永久关闭 vi /etc/selinux/config 找到SELINUXenforcing按i进入编辑模式将参数修改为SELINUXdisabled。2.2 nginx安装 安装Nginx yum -y install nginx查看Nginx版本。 # nginx -v nginx version: nginx/1.20.12.3 mysql安装 更新Yyum源 rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm安装MySQL。 注使用的操作系统内核版本为el8可能会提示报错信息No match for argument。您需要先运行命令yum module disable mysql禁用默认的MySQL模块再安装MySQL。 yum -y install mysql-community-server --nogpgcheck查看mysql版本号 返回结果如下所示表示MySQL安装成功。 # mysql -V mysql Ver 14.14 Distrib 5.7.41, for Linux (x86_64) using EditLine wrapper启动mysql systemctl start mysqld设置开机启动mysql systemctl enable mysqld systemctl daemon-reload2.4 php安装 更新yum源 yum install \ https://repo.ius.io/ius-release-el7.rpm \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm添加Webtatic源 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm安装php yum -y install php70w-devel php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-pdo.x86_64 php70w-mysqlnd php70w-fpm php70w-opcache php70w-pecl-redis php70w-pecl-mongodb查看php版本。 # php -v PHP 7.0.33 (cli) (built: Dec 6 2018 22:30:44) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologieswith Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies2.5 nginx配置 nginx 主配置文件 user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid;include /usr/share/nginx/modules/*.conf;events {worker_connections 1024; }http {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 /var/log/nginx/access.log main;sendfile on;tcp_nopush on;tcp_nodelay on;keepalive_timeout 65;types_hash_max_size 4096;include /etc/nginx/mime.types;default_type application/octet-stream;include /etc/nginx/conf.d/*.conf; }conf 文件配置 server {listen 80;server_name 域名;charset utf-8;location / {root /usr/share/nginx/xxx;try_files $uri $uri/ /index.html;index index.html index.htm index.php;}location /50x.html {root /usr/share/nginx/html/xxx;}location ~ .php$ {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}access_log /var/log/nginx/xxx.access.log main;error_log /var/log/nginx/xxx.error.log warn;#如果需要http强制跳转至https则开启 # rewrite ^(.*)$ https://$host$1 permanent;} server {listen 443 ssl;server_name 域名;charset utf-8;ssl_certificate /etc/nginx/cert/xxx.pem;ssl_certificate_key /etc/nginx/cert/xxx.key;ssl_session_timeout 5m;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_protocols TLSv1.2;ssl_prefer_server_ciphers on;location / {root /usr/share/nginx/xxx;try_files $uri $uri/ /index.html;index index.html index.htm index.php;}location /50x.html {root /usr/share/nginx/html/xxx;}location ~ .php$ {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}access_log /var/log/nginx/xxx.access.log main;error_log /var/log/nginx/xxx.error.log warn; }检查配置文件是否正确 nginx -t生效nginx配置文件 nginx -s reload2.6 mysql配置 查看/var/log/mysqld.log文件获取并记录root用户的初始密码。 grep temporary password /var/log/mysqld.log配置mysql的安全性。 mysql_secure_installation输入MySQL的初始密码。 说明 在输入密码时系统为了最大限度的保证数据安全命令行将不做任何回显。只需要输入正确的密码信息然后按Enter键即可。 Securing the MySQL server deployment.Enter password for user root: #输入上一步获取的root用户初始密码为mysql设置新密码。 The existing password for the user account root has expired. Please set a new password.New password: #输入新密码。长度为8至30个字符必须同时包含大小写英文字母、数字和特殊符号。特殊符号包含() ~!#$%^*-|{}[]:;‘,.?/Re-enter new password: #确认新密码。 The validate_password plugin is installed on the server. The subsequent steps will run with the existing configuration of the plugin. Using existing password for root.Estimated strength of the password: 100 #返回结果包含您设置的密码强度。 Change the password for root ? ((Press y|Y for Yes, any other key for No) :Y #您需要输入Y以确认使用新密码。#新密码设置完成后需要再次验证新密码。 New password:#再次输入新密码。Re-enter new password:#再次确认新密码。Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) :Y #您需要输入Y再次确认使用新密码。输入Y删除匿名用户 Remove anonymous users? (Press y|Y for Yes, any other key for No) :Y Success.输入Y禁止使用root用户远程登录mysql Disallow root login remotely? (Press y|Y for Yes, any other key for No) :Y Success.输入Y删除test库以及用户对test库的访问权限 Remove test database and access to it? (Press y|Y for Yes, any other key for No) :Y- Dropping test database... Success.- Removing privileges on test database... Success.输入Y重新加载授权表 Reload privilege tables now? (Press y|Y for Yes, any other key for No) :Y Success.All done!2.7 配置php 创建phpinfo.php文件 网站根目录是您在nginx.conf配置文件中location ~ .php$大括号内配置的root参数值如下图所示。网站根目录本文配置的网站根目录为/usr/share/nginx/html因此需要运行以下命令新建phpinfo.php文件 vim /usr/share/nginx/html/phpinfo.php输入下列内容函数phpinfo() 会展示PHP的所有配置信息。 ?php echo phpinfo(); ?启动php-fpm systemctl start php-fpm设置php-fpm开机自启动 systemctl enable php-fpm测试访问LNMP配置信息页面 在本地Windows主机或其他具有公网访问能力的Windows主机中打开浏览器。 在浏览器的地址栏输入http://域名/phpinfo.php进行访问。 访问结果为php测试页即为成功 注测试访问LNMP配置信息页面后建议将phpinfo.php文件删除消除数据泄露风险。 rm -rf /usr/share/nginx/html/phpinfo.php三、常见问题 3.1 安装其它版本的nginx服务 下载nginx 1.21.3 wget http://nginx.org/download/nginx-1.21.3.tar.gz安装Nginx相关依赖。 yum install -y gcc-c yum install -y pcre pcre-devel yum install -y zlib zlib-devel yum install -y openssl openssl-devel解压nginx 安装包 tar zxvf nginx-1.21.3.tar.gz cd nginx-1.21.3编译源码 ./configure \--usernobody \--groupnobody \--prefix/usr/local/nginx \--with-http_stub_status_module \--with-http_gzip_static_module \--with-http_realip_module \--with-http_sub_module \--with-http_ssl_modulemake make install启动nginx /usr/local/nginx/sbin/nginx3.2 php版本过低 以上安装中php默认安装的版本是 PHP 7.0.33 在某些时候php的版本过低将导致LNMP环境出现很多问题那么我们就需要升级php的版本 卸载php # 查看当前php已安装的包 rpm -qa|grep php 会出现很多php相关包,基本只需要卸载几个名为common的包即可,其他同版本依赖会被全部删除 删除php70w-common70w版本的依赖包全部会被删除。yum remove php70w-common yum remove php74w-common安装 PHP7.2 安装 EPEL 软件包 yum install epel-release安装 remi 源 yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpmyum 扩展包 yum install yum-utils启用 remi 仓库 yum-config-manager --enable remi-php72 yum update安装 PHP7.2 yum install php72安装 php-fpm 和一些其他模块 yum install php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcachephp72 -v 查看安装结果 # php72 -v PHP 7.2.34 (cli) (built: Dec 19 2022 16:12:02) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologieswith Zend OPcache v7.2.34, Copyright (c) 1999-2018, by Zend Technologies设置开机自启 systemctl enable php72-php-fpm.service常用 php-fpm 命令 # 开启服务 systemctl start php72-php-fpm.service # 停止服务 systemctl stop php72-php-fpm.service # 查看状态 systemctl status php72-php-fpm.service设置php与nginx为同一个用户名及用户组 egrep ^(user|group) /etc/nginx/nginx.conf# 结果示例 user nginx;# 编辑 /etc/opt/remi/php72/php-fpm.d/www.conf,修改执行 php-fpm 的权限vim /etc/opt/remi/php72/php-fpm.d/www.conf# 设置用户和用户组为 nginxuser nginx group nginx# 保存并关闭文件重启 php-fpm 服务systemctl restart php72-php-fpm.service路径参考 # php 安装路径 /etc/opt/remi/php72# nginx 配置文件 /etc/nginx/nginx.conf# nginx 默认项目路径 /usr/share/nginx/html
http://www.huolong8.cn/news/369850/

相关文章:

  • 下载了源码怎么做网站兼职网站建设推广人才
  • wordpress站长统计wordpress 个性博客主题
  • 3d建模素材网站唐山做网站哪家公司好
  • 大兴58网站起名网站制作哈尔滨网站开发公司
  • 新手学做网站要学什么知识图文教程做网页设计网站有哪些
  • 一个专业做设计的网站网站建设费用计入无形资产
  • 厦门大型网站设计公司网站开发用php还pyt h on
  • 分类信息建站系统陕西四通建设工程有限责任公司网站
  • 企业网站建设栏目结构图h5视频怎么制作教学
  • 为什么网站显示在建设中巩义做网站哪家好
  • 创建网站目录结构应遵循的方法注册子公司流程及所需资料
  • 网站开发 cms周口网站建设
  • 山东城市建设职业学院官方网站wordpress 主题 微商
  • 免费网站空间申请如何设置自己的网站
  • 男装网站模板演示企业品牌战略
  • 织梦通用seo网站模板如何加入小说网站做打字员
  • 网站建设i珠海个人建站模板
  • 苏州做网站推广的公司哪家好北京免费网站建设模板
  • 手机百度屏蔽我网站关键词wordpress 笔记主题
  • 怎么把在微企点做响应式网站做网站赚钱什么类型
  • 网站建设衡水怎样搭建一个个人网站
  • 建设银行网站个人中心青岛济南网页设计公司
  • 建网站如何赚钱推广策略论文
  • 郑州代理记账网站建设杭州seo优化公司
  • 缺乏门户网站建设永仁网站建设
  • phpcms建设网站毕业设计网站开发的中期报告
  • 网站备案需要多久时间推荐网站建设品牌
  • 东阳网站建设有哪些宜昌市上海中学官网
  • 商务网站建设摘要东台市住房和建设局网站
  • 开发建设信息的网站网站哪里可以查到做ddos