如何在虚拟主机中更新.htaccess

时间:2015-03-17 20:56:36

标签: php apache .htaccess

今天我从UI开发者那里得到了一个网站。我将所有* .html代码更改为* .php。它在本地服务器上运行良好。在将其发布到在线服务器上之后,我给出了

Failed to load resource: the server responded with a status of 500 (Internal Server Error) 

谷歌搜索后,我学到的是我需要更改.htaccess文件。 Digital Ocean

但是我几天前做了我的虚拟主机。我无法得到

/etc/apache2/sites-available/default

相反,我在/ etc / apache2 / sites-available /.

中有三个文件
000-default.conf  default-ssl.conf  tangelotown.org.conf

tangelotown.org.conf的内容是

<VirtualHost *:80>
    # 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 tangelotown.org
    ServerAlias www.tangelotown.org

    ServerAdmin president@tangelotown.org
    DocumentRoot /var/www/tangelotown.org/public_html

    # 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

此文件不包含

<Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
 </Directory>

正如网站上所解释的那样。请帮我解决这个问题。我的网站是 tangelotown.org

2 个答案:

答案 0 :(得分:1)

尝试在VirtualHost节之前添加Directory节,但您可能想要更改目录

<Directory /var/www/tangelotown.org/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
 </Directory>

答案 1 :(得分:0)

问题的简单答案是它有php错误。

Failed to load resource: the server responded with a status of 500 (Internal Server Error) 

以上错误表明php代码存在问题。我使用require_once(“”)并删除了所需的文件。在考虑这些问题之前,请检查错误日志。