• 安装apache


    1.安装apache2
    sudo apt-get install apache2

    2.安装php
    sudo apt-get install libapache2-mod-php5
    sudo apt-get install php5

    3.安装sql服务器
    sudo apt-get install mysql-server
    sudo apt-get install php5-mysql

    5.修改web目录权限
    chown -R www-data:www-data /var/www

    6.在/var/www新建目录niot,并将网站内容全部放到此目录

    7.在/etc/apache2/sites-available/目录下建立文件niot.conf,内容如下:
    <VirtualHost *:80>
    ServerAdmin webmaster@localhost
        RewriteEngine On
        RewriteOptions Inherit
        DocumentRoot /var/www/niot
        <Directory />
            Options FollowSymLinks
            AllowOverride None
        </Directory>
        <Directory /var/www/niot>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>
     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>

    8.建立配置文件软链接并删除默认有效配置:
    sudo ln -s /etc/apache2/sites-available/niot.conf /etc/apache2/sites-enabled/niot.conf
    sudo rm /etc/apache2/sites-available/000-default.conf(任何非niot.conf的其他文件)
    9. 使apache支持 rewrite 模块(去掉index.php)
    sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
    10. 添加 rewrite 规则 (网站根目录的 .htaccess 文件)
    RewriteEngine on                                                                                                                
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond $1 !^(index.php|images|robots.txt)
    RewriteRule ^(.*)$ /bill/index.php/$1 [L]

    11.重启apache
    sudo /etc/init.d/apache2 restart

  • 相关阅读:
    C++卷积神经网络实例:tiny_cnn代码具体解释(7)——fully_connected_layer层结构类分析
    不使用while,for,if等实现加法
    JavaScript包管理器综述
    hdu4455 dp
    Leetcode_num2_Maximum Depth of Binary Tree
    拉开大变革序幕(下):分布式计算框架与大数据
    TCP/IP协议组学习笔记
    Linux(centos 6.5) 调用java脚本以及定时运行的脚本实例及配置文件具体解释
    UVA11770
    C++再次理解虚表
  • 原文地址:https://www.cnblogs.com/bluewelkin/p/4285259.html
Copyright © 2020-2023  润新知