新apache虚拟主机上出现错误500

时间:2018-04-22 15:27:49

标签: php apache .htaccess mod-rewrite

我已经在apache上创建了一个新的虚拟主机并启用了该站点。 它看起来如下

    # Place any notes or comments you have here
# It will make any customisation easier to understand in the weeks to come

# domain: domain1.com
# public: /home/demo/public_html/domain1.com/

<VirtualHost *:80>

  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin webmaster@domain1.com
  ServerName  elexy.com
  ServerAlias www.elexy.com


  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html
  DocumentRoot /var/www/elexy/


  # Custom log file locations
  LogLevel warn
  ErrorLog /var/log/apache2/error-elexy.com.log
  CustomLog /var/log/apache2/access-elexy.com.log combined

</VirtualHost>

当我前往http://localhost/elexy/时 我收到内部服务器错误500。

从日志中,我得到了

  

由于可能,请求超出了10个内部重定向的限制   配置错误。使用&#39; LimitInternalRecursion&#39;增加   必要时限制。使用&#39; LogLevel debug&#39;获得回溯。

我在文件夹中有.htaccess文件,但是,如果我将此目录复制到/ var / www / html /并尝试访问它。它运作得很好。

我不确定我在这里失踪了什么。

这是.htaccess文件 现在这是其他人在php中编写的软件。我自己没有写.htaccess。

Options +FollowSymLinks -MultiViews +Indexes
<FilesMatch "\.(htaccess|htpasswd|ini|log|sh|inc|bak|tpl)$">
Order Allow,Deny
Deny from all
</FilesMatch>

# Cache Control
<IfModule mod_headers.c>
<FilesMatch "\.(jpg|jpeg|png|gif|swf|css|js)$">
    Header set Cache-Control "max-age=604800, public"
</FilesMatch>
</IfModule>

RewriteEngine on
RewriteOptions MaxRedirects=1
RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
RewriteCond %{REQUEST_FILENAME} -d [NC]
RewriteRule .* - [L]

# Installer
RewriteRule ^install/?$ install.php [L]

# Static Pages
RewriteRule ^static/([^/]+)/?$ static.php?url=$1 [L]

# Contacts
RewriteRule ^contacts/?$ contact.php [L]

# Directory
RewriteRule ^directory/?$ directory.php [L]
RewriteRule ^directory/([^/]+)/?$ directory.php?view=$1 [L]
RewriteRule ^directory/([^/]+)/([^/]+)/?$ directory.php?view=$1&page=$2 [L]

# Search
RewriteRule ^search/?$ search.php [L]
RewriteRule ^search/hashtag/([^/]+)/?$ search.php?query=$1&hashtag=1 [L]
RewriteRule ^search/([^/]+)/?$ search.php?query=$1&hashtag=0 [L]

# Sign(in|up|out)
RewriteRule ^signin/?$ sign.php?do=in [L]
RewriteRule ^signup/?$ sign.php?do=up [L]
RewriteRule ^signout/?$ sign.php?do=out [L]
RewriteRule ^reset/?$ sign.php?do=reset [L]
RewriteRule ^activation/([^/]+)/([^/]+)/?$ activation.php?id=$1&token=$2 [L]

# Social Logins
RewriteRule ^connect/([^/]+)/?$ connect.php?do=connect&provider=$1 [L]
RewriteRule ^revoke/([^/]+)/?$ connect.php?do=revoke&provider=$1 [L]

# Packages
RewriteRule ^packages/?$ packages.php [L]

# Started
RewriteRule ^started/?$ started.php [L]
RewriteRule ^started/finished?$ started.php?finished=true [L]

# Messages
RewriteRule ^messages/?$ messages.php [L]
RewriteRule ^messages/new?$ messages.php?view=new [L]
RewriteRule ^messages/([^/]+)/?$ messages.php?cid=$1 [L]

# Notifications
RewriteRule ^notifications/?$ notifications.php [L]

# Settings
RewriteRule ^settings/?$ settings.php [L]
RewriteRule ^settings/([^/]+)/?$ settings.php?view=$1 [L]

# Posts & Photos
RewriteRule ^posts/([^/]+)/?$ post.php?post_id=$1 [L]
RewriteRule ^photos/([^/]+)/?$ photo.php?photo_id=$1 [L]
RewriteRule ^buy/([^/]+)/?$ buy.php?post_id=$1 [L]

# Saved
RewriteRule ^saved/?$ index.php?view=saved [L]

# People
RewriteRule ^people/?$ people.php [L]
RewriteRule ^people/find/?$ people.php?view=find [L]
RewriteRule ^people/friend_requests/?$ people.php?view=friend_requests [L]
RewriteRule ^people/sent_requests/?$ people.php?view=sent_requests [L]

# Pages
RewriteRule ^pages/?$ pages.php [L]
RewriteRule ^pages/liked/?$ pages.php?view=liked [L]
RewriteRule ^pages/manage/?$ pages.php?view=manage [L]
RewriteRule ^pages/([^/]+)/?$ page.php?username=$1 [L,QSA]
RewriteRule ^pages/([^/]+)/([^/]+)/?$ page.php?username=$1&view=$2 [L]
RewriteRule ^pages/([^/]+)/([^/]+)/([^/]+)/?$ page.php?username=$1&view=$2&id=$3 [L]

# Groups
RewriteRule ^groups/?$ groups.php [L]
RewriteRule ^groups/joined/?$ groups.php?view=joined [L]
RewriteRule ^groups/manage/?$ groups.php?view=manage [L]
RewriteRule ^groups/([^/]+)/?$ group.php?username=$1 [L,QSA]
RewriteRule ^groups/([^/]+)/([^/]+)/?$ group.php?username=$1&view=$2 [L]
RewriteRule ^groups/([^/]+)/([^/]+)/([^/]+)/?$ group.php?username=$1&view=$2&id=$3 [L]

# Events
RewriteRule ^events/?$ events.php [L]
RewriteRule ^events/going/?$ events.php?view=going [L]
RewriteRule ^events/interested/?$ events.php?view=interested [L]
RewriteRule ^events/invited/?$ events.php?view=invited [L]
RewriteRule ^events/manage/?$ events.php?view=manage [L]
RewriteRule ^events/([^/]+)/?$ event.php?event_id=$1 [L,QSA]
RewriteRule ^events/([^/]+)/([^/]+)/?$ event.php?event_id=$1&view=$2 [L]
RewriteRule ^events/([^/]+)/([^/]+)/([^/]+)/?$ event.php?event_id=$1&view=$2&id=$3 [L]

# Blogs
RewriteRule ^articles/?$ index.php?view=articles [L]
RewriteRule ^blogs/?$ blogs.php [L]
RewriteRule ^blogs/new/?$ blogs.php?view=new [L]
RewriteRule ^blogs/edit/([^/]+)/?$ blogs.php?view=edit&post_id=$1 [L]
RewriteRule ^blogs/([^/]+)/([^/]+)/?$ blogs.php?view=article&post_id=$1 [L]

# Market
RewriteRule ^products/?$ index.php?view=products [L]
RewriteRule ^market/?$ market.php [L]
RewriteRule ^market/search/?$ market.php?view=search [L]
RewriteRule ^market/search/([^/]+)/?$ market.php?view=search&query=$1 [L]
RewriteRule ^market/search/([^/]+)/([^/]+)/?$ market.php?view=search&query=$1&page=$2 [L]
RewriteRule ^market/category/([^/]+)/?$ market.php?view=category&category_id=$1 [L]
RewriteRule ^market/category/([^/]+)/([^/]+)/?$ market.php?view=category&category_id=$1&category_url=$2 [L]
RewriteRule ^market/category/([^/]+)/([^/]+)/([^/]+)/?$ market.php?view=category&category_id=$1&category_url=$2&page=$3 [L]
RewriteRule ^market/([^/]+)/?$ market.php?page=$1 [L]

# Games
RewriteRule ^games/?$ games.php [L]
RewriteRule ^games/played/?$ games.php?view=played [L]
RewriteRule ^games/([^/]+)/?$ game.php?id=$1 [L]

#Movies
RewriteRule ^movies/?$ movies.php?view=all [L]
RewriteRule ^movies/movies/?$ movies.php?view=movies [L]
RewriteRule ^movies/tv/?$ movies.php?view=tv [L]
RewriteRule ^movies/([^/]+)/?$ movie.php?id=$1 [L]

#Comics
RewriteRule ^comics/?$ comics.php [L]
RewriteRule ^comics/add/?$ comics.php?view=add [L]
RewriteRule ^comics/([^/]+)/?$ comic.php?id=$1 [L]
RewriteRule ^comics/edit/([^/]+)/?$ comics.php?view=edit&comic_id=$1 [L]

# Admin Panel
RewriteRule ^admincp/?$ admin.php [L]
RewriteRule ^admincp/([^/]+)/?$ admin.php?view=$1 [L]
RewriteRule ^admincp/([^/]+)/([^/]+)/?$ admin.php?view=$1&sub_view=$2 [L]
RewriteRule ^admincp/([^/]+)/([^/]+)/([^/]+)/?$ admin.php?view=$1&sub_view=$2&id=$3 [L]

# Profile
RewriteRule ^([^/]+)/?$ profile.php?username=$1 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/?$ profile.php?username=$1&view=$2 [L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ profile.php?username=$1&view=$2&id=$3 [L]

我不确定这里发生了什么。 寻找知道他们比我做得更好的人的建议。

感谢。

0 个答案:

没有答案