Ubuntu 16.10 Apache PHP Server

简介: /******************************************************************************************* * Ubuntu 16.10 Apache PHP Server * 说明: * 需要用到16.10系统上装一个PHP的环境来做代码测试,记录一下几个关键的配置。
/*******************************************************************************************
 *                           Ubuntu 16.10 Apache PHP Server 
 * 说明:
 *     需要用到16.10系统上装一个PHP的环境来做代码测试,记录一下几个关键的配置。
 *
 *                                                        2017-2-27 深圳 南山平山村 曾剑锋
 ******************************************************************************************/

一、参考文档:
    1. Apache提示You don't have permission to access / on this server问题解决
        http://sjpsega.iteye.com/blog/1507439 
    2. Multiple ports on Apache2
        http://serverfault.com/questions/722493/multiple-ports-on-apache2

二、开启端口
    /etc/apache2/ports.conf
        # If you just change the port or add more ports here, you will likely also # have to change the VirtualHost statement in
        # /etc/apache2/sites-enabled/000-default.conf
        
        Listen 80
        
        <IfModule ssl_module>
                Listen 443
        </IfModule>
        
        <IfModule mod_gnutls.c>
                Listen 443
        </IfModule>
        
        listen 8888   # 开启独立的端口
        
        # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

三、配置路径
    /etc/apache2/sites-available/001-ARMDesktop.conf
        <VirtualHost *:8888> # The ServerName directive sets the request scheme, hostname and port that
                # the server uses to identify itself. This is used when creating
                # redirection URLs. In the context of virtual hosts, the ServerName
                # specifies what hostname must appear in the request's Host: header to
                # match this virtual host. For the default virtual host (this file) this
                # value is not decisive as it is used as a last resort host regardless.
                # However, you must set it for any further virtual host explicitly.
                #ServerName www.example.com
        
                ServerAdmin webmaster@localhost
                DocumentRoot /home/zengjf/zengjf/zengjfos/ARMDesktop
        
                # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
                # error, crit, alert, emerg.
                # It is also possible to configure the loglevel for particular
                # modules, e.g.
                #LogLevel info ssl:warn
        
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
        
                # For most configuration files from conf-available/, which are
                # enabled or disabled at a global level, it is possible to
                # include a line for only one particular virtual host. For example the
                # following line enables the CGI configuration for this host only
                # after it has been globally disabled with "a2disconf".
                #Include conf-available/serve-cgi-bin.conf
        </VirtualHost>
        
        # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

四、error:
    1. You don't have permission to access / on this server.

    2. 解决办法:
        /etc/apache2/apache2.conf
            ...
            # Sets the default security model of the Apache2 HTTPD server. It does
            # not allow access to the root filesystem outside of /usr/share and /var/www.
            # The former is used by web applications packaged in Debian,
            # the latter may be used for local directories served by the web server. If
            # your system is serving content from a sub-directory in /srv you must allow
            # access here, or in any related virtual host.
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
                    Require all denied
            </Directory>
            
            <Directory /usr/share>
                    AllowOverride None
                    Require all granted
            </Directory>
            
            <Directory /var/www/>
                    Options Indexes FollowSymLinks
                    AllowOverride None
                    Require all granted
            </Directory>
            
            <Directory /home/zengjf/zengjf/zengjfos/ARMDesktop>
                    Options Indexes FollowSymLinks
                    Require all granted
            </Directory>
            
            #<Directory /srv/>
            #       Options Indexes FollowSymLinks
            #       AllowOverride None
            #       Require all granted
            #</Directory>
            ...
 

 

目录
相关文章
|
3月前
|
Ubuntu Java 应用服务中间件
如何通过 Apt-Get 在 Ubuntu 14.04 上安装 Apache Tomcat 7
如何通过 Apt-Get 在 Ubuntu 14.04 上安装 Apache Tomcat 7
92 0
|
3月前
|
消息中间件 Ubuntu Java
在Ubuntu 18.04上安装Apache Kafka的方法
在Ubuntu 18.04上安装Apache Kafka的方法
174 0
|
3月前
|
Ubuntu 安全 网络安全
如何在 Ubuntu 14.04 上为 Apache 创建 SSL 证书
如何在 Ubuntu 14.04 上为 Apache 创建 SSL 证书
31 0
|
9天前
|
Ubuntu PHP 开发者
如何在Ubuntu中切换多个PHP版本
通过上述步骤,您不仅能够高效地在Ubuntu系统中安装和切换PHP版本,还能根据项目需求灵活配置,大大提升开发效率与灵活性。更多关于服务器配置与优化的信息,获取全面的技术支持与解决方案。
14 1
|
4天前
|
消息中间件 Ubuntu Java
Ubuntu系统上安装Apache Kafka
Ubuntu系统上安装Apache Kafka
|
30天前
|
Ubuntu 网络安全 Apache
Ubuntu下安装Apache2.4.7遇到的问题及解决办法
Ubuntu下安装Apache2.4.7遇到的问题及解决办法
|
3月前
|
关系型数据库 MySQL 应用服务中间件
win7系统搭建PHP+Mysql+Apache环境+部署ecshop项目
这篇文章介绍了如何在Windows 7系统上搭建PHP、MySQL和Apache环境,并部署ECShop项目,包括安装配置步骤、解决常见问题以及使用XAMPP集成环境的替代方案。
53 1
win7系统搭建PHP+Mysql+Apache环境+部署ecshop项目
|
3月前
|
PHP Windows
【Azure App Service for Windows】 PHP应用出现500 : The page cannot be displayed because an internal server error has occurred. 错误
【Azure App Service for Windows】 PHP应用出现500 : The page cannot be displayed because an internal server error has occurred. 错误
|
3月前
|
Ubuntu 网络安全 数据安全/隐私保护
ubuntu server连接wifi教程
本文提供了一个简化Ubuntu Server在Raspberry Pi系统上配置过程的脚本"config_ubuntu_server",包括自动和手动两种方法来设置root权限、SSH配置,并连接WiFi,同时支持无密码SSH访问,适合初学者和高级用户。
78 3
|
3月前
|
前端开发 PHP 开发者
React Server Component 使用问题之怎么使用Docker运行PHP应用
React Server Component 使用问题之怎么使用Docker运行PHP应用