将子域指向安装在ubuntu 12.04上的phpmyadmin

前端之家收集整理的这篇文章主要介绍了将子域指向安装在ubuntu 12.04上的phpmyadmin前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这个设置我一直在苦苦挣扎.我安装了PHPmydamin的所有先决条件,本身可以在ip / PHPmyadmin上找到.现在我有一个我想指向它的子域.假设我想将data.somedomain.com指向PHPmyadmin这样一种方式,而不是ip / PHPmyadmin,我可以访问它作为data.somedomain.com.我一直在做简单的VirtualHost创建但我觉得有点丢失这个.
这是/etc/PHPmyadmin/apache.conf:
# PHPMyAdmin default Apache configuration
<VirtualHost *:80>
  ServerName data.somedomain.com

  Alias /PHPmyadmin /usr/share/PHPmyadmin

 <Directory /usr/share/PHPmyadmin>
    Options FollowSymLinks
    DirectoryIndex index.PHP

    Options All
    AllowOverride All
    Require all granted
    <IfModule mod_PHP5.c>
            AddType application/x-httpd-PHP .PHP

            PHP_flag magic_quotes_gpc Off
            PHP_flag track_vars On
            PHP_flag register_globals Off
            PHP_admin_flag allow_url_fopen Off
            PHP_value include_path .
            PHP_admin_value upload_tmp_dir /var/lib/PHPmyadmin/tmp
            PHP_admin_value open_basedir /usr/share/PHPmyadmin/:/etc/PHPmyadmin/:/var/lib/PHPmyadmin/
    </IfModule>
   <IfModule mod_PHP5.c>
            AddType application/x-httpd-PHP .PHP

            PHP_flag magic_quotes_gpc Off
            PHP_flag track_vars On
            PHP_flag register_globals Off
            PHP_admin_flag allow_url_fopen Off
            PHP_value include_path .
            PHP_admin_value upload_tmp_dir /var/lib/PHPmyadmin/tmp
            PHP_admin_value open_basedir /usr/share/PHPmyadmin/:/etc/PHPmyadmin/:/var/lib/PHPmyadmin/
    </IfModule>

</Directory>

# Authorize for setup
<Directory /usr/share/PHPmyadmin/setup>
    <IfModule mod_authn_file.c>
        AuthType Basic
        AuthName "PHPMyAdmin Setup"
        AuthUserFile /etc/PHPmyadmin/htpasswd.setup
    </IfModule>
    Require valid-user
 </Directory>

 # Disallow web access to directories that don't need it

 <Directory /usr/share/PHPmyadmin/libraries>
    Order Deny,Allow
    Deny from All
 </Directory>
 <Directory /usr/share/PHPmyadmin/setup/lib>
    Order Deny,Allow
    Deny from All
 </Directory>

</VirtualHost>

添加的是< VirtualHost>标记包装器和ServerName以及这些选项所有AllowOverride All要求全部授予

当我访问该URL时,它会抛出一个404代码:在此服务器上找不到请求的URL /.

并且日志包含此条目:文件不存在:/ etc / apache2 / htdocs
谢谢你的建议.

您需要做的就是为apache设置子域.您可以通过在/ etc / apache2 / sites-available中创建配置文件来完成此操作.

这是我的……

<VirtualHost *:80>
   ServerAdmin adminn@example.local
   ServerName PHPmyadmin.example.local
   DocumentRoot /usr/share/PHPmyadmin
   <Directory />
       Options FollowSymLinks
       AllowOverride None
   </Directory>
   LogLevel notice
   CustomLog /var/log/apache2/access.log combined
   ErrorLog /var/log/apache2/error.log
   ServerSignature On
</VirtualHost>

将其保存到/etc/apache2/sites-available/PHPmyadmin.conf并启用子域.

a2ensite PHPmyadmin

并重新启动Apache服务器

service apache2 reload

现在你应该可以使用PHPmyadmin.example.local中的PHPmyadmin了.

原文链接:https://www.f2er.com/ubuntu/348193.html

猜你在找的Ubuntu相关文章