• centos7搭建LAMP


    LAMP = Linux + Apache + MySQL + PHP

    1)Apache
    yum install httpd
    启动服务,开机自起,开放80端口

    2)MySQL
    由于yum源上没有mysql-server。所以必须去官网下载,这里 我们用wget命令,直接获取。
    # wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm # rpm -ivh mysql-community-release-el7-5.noarch.rpm # yum install mysql-community-server
    启动服务,开机自起,开放3306端口,(设置root密码)
    重启计算机

    3)PHP
    yum install php
    #安装PHP组件,使PHP支持mysql
    yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
    可能需要重启mysqld和httpd
    案考:安装LAMPhttp://www.cnblogs.com/wgq123/p/6028718.html
    4)配置虚拟主机
    一台计算机可以放置多个网站,称为ie虚拟主机,不同的网站通过不同的域名访问,每一个网站对应磁盘上的单独的目录。
    centos7 apache2.4(配置文件目录结构跟linux版本、apache版本有关系,但配置理念一样,apache版本一样时配置方法基本一样,路径可能不同)
    vim /etc/httpd/conf/httpd.conf
    增加include vhost.d/*.conf
    mkdir /etc/httpd/vhost.d/
    [root@centos7-1 httpd]# cat ./vhost.d/name.conf 
    <VirtualHost *:80>
        ServerAdmin admin@amsilence.com
        DocumentRoot "/var/html/www"
        ServerName www.centos7-1.com
        ErrorLog "/var/httpd/logs/www-error_log"
        CustomLog "/var/httpd/logs/www-access_log" common
    </VirtualHost>
    
    <Directory /var/html/www/>    可改成 DirectoryIndex index.php index.html放到<Vir...>    </Vir...>中
    Require all granted
    </Directory>
    
    <VirtualHost *:80>
        ServerAdmin admin@amsilence.com
        DocumentRoot "/var/html/bbs"
        ServerName bbs.centos7-1.com
        ErrorLog "/var/httpd/logs/bbs-error_log"
        CustomLog "/var/httpd/logs/bbs-access_log" common
    </VirtualHost>
    
    <Directory /var/html/bbs/>
    Require all granted
    </Directory>
    

    检查配置:/sbin/service httpd configtest

    重启httpd服务。  

    参考http://blog.csdn.net/wusilen/article/details/54317822



    网页分为动态和静态两种,静态网页用户每次看到的内容都一样。

    DNS图

    动态网页是服务器上的程序,次程序可以由C、bash、PHP、Java、Python、Ruby等语言编写。当用户去浏览某个动态网页时文件时,服务器临时去执行这个网页文件(实际上就是程序),
    执行结果就是生成一份完整的HTML文件保存在内存中,而不是硬盘上。


  • 相关阅读:
    leetcode ——187. 重复的DNA序列
    leetcode——30. 串联所有单词的子串
    leetcode——520. 检测大写字母
    leetcode——686. 重复叠加字符串匹配
    leetcode——459. 重复的子字符串
    leetcode——28. 实现 strStr()
    leetcode——17. 电话号码的字母组合
    leetcode——14. 最长公共前缀
    NAT模式实现局域网物理机与虚拟机的互通访问
    .Net Core项目发布到虚拟机(三)
  • 原文地址:https://www.cnblogs.com/daduryi/p/6637518.html
Copyright © 2020-2023  润新知