我无法获得除主页之外的任何链接,而不会收到以下错误。
"未找到在此服务器上找不到请求的URL /相册。 Apache.com上的Apache / 2.4.7(Ubuntu)服务器端口443"
我之前遇到过同样的问题,并且花了好几个小时才结束了非常简单的事情。我安装了LetsEncrypt。下面是我的000-default.conf,.htaccess和000-default-le-ssl.conf。有人可以告诉我我做错了什么......
<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://example.com/
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ScriptAlias /cgi-bin/ /var/cgi-bin/
<Directory "/var/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
<Directory /var/www/html>
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>
<VirtualHost *:80>
ServerName www.example.com
Redirect permanent / https://example.com/
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
以下是000-default-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ScriptAlias /cgi-bin/ /var/cgi-bin/
<Directory "/var/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
<Directory /var/www/html>
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
SSLCertificateFile /etc/letsencrypt/live/example.com-0001/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com-0001/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/example.com-0001/chain.pem
</VirtualHost>
</IfModule>
.htaccess文件
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /var/www/html
RewriteRule ^ajax/search$ ajax_search.php
RewriteRule ^signup$ signup.php
RewriteRule ^ajax/check_username$ ajax_check_username.php
RewriteRule ^logout$ logout.php
RewriteRule ^login$ login.php
RewriteRule ^lost$ lost.php
RewriteRule ^confirm$ confirm.php
RewriteRule ^mail/inbox$ inbox.php
RewriteRule ^mail/read$ read.php
RewriteRule ^mail/compose$ compose.php
RewriteRule ^mail/outbox$ outbox.php
RewriteRule ^requests$ requests.php
RewriteRule ^videos$ videos.php
RewriteRule ^myvideos$ myvideos.php
RewriteRule ^categories$ categories.php
RewriteRule ^albums$ albums.php
RewriteRule ^community$ community.php
RewriteRule ^users$ users.php
RewriteRule ^resetpassword/(.*) resetpassword.php?code=$1
RewriteRule ^confirmemail/(.*) confirmemail.php?code=$1
RewriteRule ^user/(.*)/(.*)/blog/(.*) memberblog.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/blog memberblog.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/albums/(.*) memberalbums.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/albums memberalbums.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/favorite/photos/(.*) memberfavphotos.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/favorite/photos memberfavphotos.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/favorite/videos/(.*) memberfavvideos.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/favorite/videos memberfavvideos.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/videos/public/(.*) memberpubvideos.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/videos/public memberpubvideos.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/videos/private/(.*) memberprivideos.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/videos/private memberprivideos.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/friends/(.*) memberfriends.php?pid=$1&username=$2&etc=$3
RewriteRule ^user/(.*)/(.*)/friends$ memberfriends.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/subscribers/(.*) membersubscribers.php?pid=$1&username=$2&etc=$3
RewriteRule ^user/(.*)/(.*)/subscribers$ membersubscribers.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/wall memberwall.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/subscriptions/(.*) membersubscriptions.php?pid=$1&username=$2&etc=$3
RewriteRule ^user/(.*)/(.*)/subscriptions$ membersubscriptions.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/playlist/(.*) memberplaylist.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/playlist memberplaylist.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*) memberprofile.php?pid=$1&username=$2
RewriteRule ^ajax/insert_favorite_photos$ ajax_insert_favorite_photos.php
RewriteRule ^ajax/insert_my_photos$ ajax_insert_my_photos.php
RewriteRule ^ajax/insert_playlist_videos$ ajax_insert_playlist_videos.php
RewriteRule ^ajax/insert_my_videos$ ajax_insert_my_videos.php
RewriteRule ^ajax/insert_favorite_videos$ ajax_insert_favorite_videos.php
RewriteRule ^upload$ upload.php
RewriteRule ^upload/video$ uploadvideo.php
RewriteRule ^upload/photo$ uploadphoto.php
RewriteRule ^edit$ edit.php
RewriteRule ^prefs$ prefs.php
RewriteRule ^avatar$ avatar.php
RewriteRule ^album/edit/(.*) editalbum.php?aid=$1
RewriteRule ^album/addphotos/(.*) addphotosalbum.php?aid=$1
RewriteRule ^album/delete/(.*) deletealbum.php?aid=$1
RewriteRule ^album/slideshow/(.*) slideshow.php?aid=$1
RewriteRule ^album/(.*)/(.*) viewalbum.php?aid=$1&page=$2
RewriteRule ^ajax/album_cover$ ajax_album_cover.php
RewriteRule ^photo/(.*)/(.*) viewphoto.php?pid=$1&page=$2
RewriteRule ^video/(.*)/(.*) playvideo.php?videoid=$1&page=$2
RewriteRule ^ajax/rate_video$ ajax_rate_video.php
RewriteRule ^ajax/rate_photo$ ajax_rate_photo.php
RewriteRule ^ajax/favorite_video$ ajax_favorite_video.php
RewriteRule ^ajax/favorite_photo$ ajax_favorite_photo.php
RewriteRule ^ajax/flag_video$ ajax_flag_video.php
RewriteRule ^ajax/flag_photo$ ajax_flag_photo.php
RewriteRule ^ajax/share_video$ ajax_share_video.php
RewriteRule ^ajax/share_photo$ ajax_share_photo.php
RewriteRule ^ajax/photo_comment$ ajax_photo_comment.php
RewriteRule ^ajax/photo_pagination$ ajax_photo_pagination.php
RewriteRule ^ajax/photo_comment_delete$ ajax_photo_comment_delete.php
RewriteRule ^ajax/video_comment_delete$ ajax_video_comment_delete.php
RewriteRule ^ajax/wall_comment_delete$ ajax_wall_comment_delete.php
RewriteRule ^ajax/report_spam$ ajax_report_spam.php
RewriteRule ^ajax/remove_photo_favorite$ ajax_remove_photo_favorite.php
RewriteRule ^ajax/upload_progress$ ajax_upload_progress.php
RewriteRule ^search$ search.php
RewriteRule ^ajax/related_videos$ ajax_related_videos.php
RewriteRule ^ajax/video_comment$ ajax_video_comment.php
RewriteRule ^ajax/video_pagination$ ajax_video_pagination.php
RewriteRule ^ajax/video_comment_delete$ ajax_video_comment_delete.php
RewriteRule ^ajax/remove_video_playlist$ ajax_remove_video_playlist.php
RewriteRule ^ajax/remove_video_favorite$ ajax_remove_video_favorite.php
RewriteRule ^ajax/wall_comment$ ajax_wall_comment.php
RewriteRule ^ajax/wall_pagination$ ajax_wall_pagination.php
RewriteRule ^ajax/subscribe$ ajax_subscribe.php
RewriteRule ^ajax/unsubscribe$ ajax_unsubscribe.php
RewriteRule ^ajax/block_user$ ajax_block_user.php
RewriteRule ^ajax/unblock_user$ ajax_unblock_user.php
RewriteRule ^ajax/report_user$ ajax_report_user.php
RewriteRule ^ajax/invite_friend$ ajax_invite_friend.php
RewriteRule ^ajax/send_message$ ajax_send_message.php
RewriteRule ^ajax/rate_user$ ajax_rate_user.php
RewriteRule ^ajax/remove_friend$ ajax_remove_friend.php
RewriteRule ^ajax/accept_friend$ ajax_accept_friend.php
RewriteRule ^ajax/reject_friend$ ajax_reject_friend.php
RewriteRule ^ajax/category_videos$ ajax_category_videos.php
RewriteRule ^ajax/users$ ajax_users.php
RewriteRule ^ajax/blog_comment$ ajax_blog_comment.php
RewriteRule ^ajax/blog_pagination$ ajax_blog_pagination.php
RewriteRule ^ajax/blog_comment_delete$ ajax_blog_comment_delete.php
RewriteRule ^blog/add$ blog_add.php
RewriteRule ^blog/edit/(.*)/(.*) blog_edit.php?bid=$1&title=$2
RewriteRule ^blog/delete/(.*) blog_delete.php?bid=$1
RewriteRule ^blog/(.*)/(.*) viewblog.php?bid=$1&title=$2
RewriteRule ^ajax/blog_preview$ ajax_blog_preview.php
RewriteRule ^blogs$ blogs.php
RewriteRule ^invite$ invite.php
RewriteRule ^feedback$ feedback.php
RewriteRule ^static/faq$ faq.php
RewriteRule ^static/terms$ terms.php
RewriteRule ^static/privacy$ privacy.php
RewriteRule ^static/dmca$ dmca.php
RewriteRule ^static/_2257$ 2257.php
RewriteRule ^static/webmasters$ webmasters.php
RewriteRule ^static/advertise$ advertise.php
RewriteRule ^notices$ notices.php
RewriteRule ^notice/(.*)/(.*) viewnotice.php?nid=$1&title=$2
RewriteRule ^ajax/notice_comment$ ajax_notice_comment.php
RewriteRule ^ajax/notice_pagination$ ajax_notice_pagination.php
RewriteRule ^ajax/notice_comment_delete$ ajax_notice_comment_delete.php
RewriteRule ^blocks$ blocks.php
RewriteRule ^delete$ delete.php
RewriteRule ^download/video/(.*)/(.*) downloadvideo.php?VIDEOID=$1&title=$2
RewriteRule ^rss$ rss.php
RewriteRule ^photos$ photos.php
</IfModule>
<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off
# The below probably isn't needed,
# but better safe than sorry.
SecFilterScanPOST Off
</IfModule>
答案 0 :(得分:0)
这是重写网址的正确方法。
<强> 000-default.conf 强>
<VirtualHost *:80>
ServerName example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
#ScriptAlias /cgi-bin/ /var/cgi-bin/
# <Directory "/var/cgi-bin">
# AllowOverride None
# Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
# Require all granted
# </Directory>
<Directory /var/www/html>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80>
ServerName www.example.com
Redirect permanent / https://example.com/
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
<强> 000 - 缺省 - LE-ssl.conf中强>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
#ScriptAlias /cgi-bin/ /var/cgi-bin/
# <Directory "/var/cgi-bin">
# AllowOverride None
# Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
# Require all granted
# </Directory>
<Directory /var/www/html>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /etc/letsencrypt/live/example.com-0001/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com-0001/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/example.com-0001/chain.pem
</VirtualHost>
</IfModule>
<强>的.htaccess 强>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^ajax/search$ ajax_search.php
RewriteRule ^signup$ signup.php
RewriteRule ^ajax/check_username$ ajax_check_username.php
RewriteRule ^logout$ logout.php
RewriteRule ^login$ login.php
RewriteRule ^lost$ lost.php
RewriteRule ^confirm$ confirm.php
RewriteRule ^mail/inbox$ inbox.php
RewriteRule ^mail/read$ read.php
RewriteRule ^mail/compose$ compose.php
RewriteRule ^mail/outbox$ outbox.php
RewriteRule ^requests$ requests.php
RewriteRule ^videos$ videos.php
RewriteRule ^myvideos$ myvideos.php
RewriteRule ^categories$ categories.php
RewriteRule ^albums$ albums.php
RewriteRule ^community$ community.php
RewriteRule ^users$ users.php
RewriteRule ^resetpassword/(.*) resetpassword.php?code=$1
RewriteRule ^confirmemail/(.*) confirmemail.php?code=$1
RewriteRule ^user/(.*)/(.*)/blog/(.*) memberblog.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/blog memberblog.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/albums/(.*) memberalbums.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/albums memberalbums.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/favorite/photos/(.*) memberfavphotos.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/favorite/photos memberfavphotos.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/favorite/videos/(.*) memberfavvideos.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/favorite/videos memberfavvideos.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/videos/public/(.*) memberpubvideos.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/videos/public memberpubvideos.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/videos/private/(.*) memberprivideos.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/videos/private memberprivideos.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/friends/(.*) memberfriends.php?pid=$1&username=$2&etc=$3
RewriteRule ^user/(.*)/(.*)/friends$ memberfriends.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/subscribers/(.*) membersubscribers.php?pid=$1&username=$2&etc=$3
RewriteRule ^user/(.*)/(.*)/subscribers$ membersubscribers.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/wall memberwall.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/subscriptions/(.*) membersubscriptions.php?pid=$1&username=$2&etc=$3
RewriteRule ^user/(.*)/(.*)/subscriptions$ membersubscriptions.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*)/playlist/(.*) memberplaylist.php?pid=$1&username=$2&page=$3
RewriteRule ^user/(.*)/(.*)/playlist memberplaylist.php?pid=$1&username=$2
RewriteRule ^user/(.*)/(.*) memberprofile.php?pid=$1&username=$2
RewriteRule ^ajax/insert_favorite_photos$ ajax_insert_favorite_photos.php
RewriteRule ^ajax/insert_my_photos$ ajax_insert_my_photos.php
RewriteRule ^ajax/insert_playlist_videos$ ajax_insert_playlist_videos.php
RewriteRule ^ajax/insert_my_videos$ ajax_insert_my_videos.php
RewriteRule ^ajax/insert_favorite_videos$ ajax_insert_favorite_videos.php
RewriteRule ^upload$ upload.php
RewriteRule ^upload/video$ uploadvideo.php
RewriteRule ^upload/photo$ uploadphoto.php
RewriteRule ^edit$ edit.php
RewriteRule ^prefs$ prefs.php
RewriteRule ^avatar$ avatar.php
RewriteRule ^album/edit/(.*) editalbum.php?aid=$1
RewriteRule ^album/addphotos/(.*) addphotosalbum.php?aid=$1
RewriteRule ^album/delete/(.*) deletealbum.php?aid=$1
RewriteRule ^album/slideshow/(.*) slideshow.php?aid=$1
RewriteRule ^album/(.*)/(.*) viewalbum.php?aid=$1&page=$2
RewriteRule ^ajax/album_cover$ ajax_album_cover.php
RewriteRule ^photo/(.*)/(.*) viewphoto.php?pid=$1&page=$2
RewriteRule ^video/(.*)/(.*) playvideo.php?videoid=$1&page=$2
RewriteRule ^ajax/rate_video$ ajax_rate_video.php
RewriteRule ^ajax/rate_photo$ ajax_rate_photo.php
RewriteRule ^ajax/favorite_video$ ajax_favorite_video.php
RewriteRule ^ajax/favorite_photo$ ajax_favorite_photo.php
RewriteRule ^ajax/flag_video$ ajax_flag_video.php
RewriteRule ^ajax/flag_photo$ ajax_flag_photo.php
RewriteRule ^ajax/share_video$ ajax_share_video.php
RewriteRule ^ajax/share_photo$ ajax_share_photo.php
RewriteRule ^ajax/photo_comment$ ajax_photo_comment.php
RewriteRule ^ajax/photo_pagination$ ajax_photo_pagination.php
RewriteRule ^ajax/photo_comment_delete$ ajax_photo_comment_delete.php
RewriteRule ^ajax/video_comment_delete$ ajax_video_comment_delete.php
RewriteRule ^ajax/wall_comment_delete$ ajax_wall_comment_delete.php
RewriteRule ^ajax/report_spam$ ajax_report_spam.php
RewriteRule ^ajax/remove_photo_favorite$ ajax_remove_photo_favorite.php
RewriteRule ^ajax/upload_progress$ ajax_upload_progress.php
RewriteRule ^search$ search.php
RewriteRule ^ajax/related_videos$ ajax_related_videos.php
RewriteRule ^ajax/video_comment$ ajax_video_comment.php
RewriteRule ^ajax/video_pagination$ ajax_video_pagination.php
RewriteRule ^ajax/video_comment_delete$ ajax_video_comment_delete.php
RewriteRule ^ajax/remove_video_playlist$ ajax_remove_video_playlist.php
RewriteRule ^ajax/remove_video_favorite$ ajax_remove_video_favorite.php
RewriteRule ^ajax/wall_comment$ ajax_wall_comment.php
RewriteRule ^ajax/wall_pagination$ ajax_wall_pagination.php
RewriteRule ^ajax/subscribe$ ajax_subscribe.php
RewriteRule ^ajax/unsubscribe$ ajax_unsubscribe.php
RewriteRule ^ajax/block_user$ ajax_block_user.php
RewriteRule ^ajax/unblock_user$ ajax_unblock_user.php
RewriteRule ^ajax/report_user$ ajax_report_user.php
RewriteRule ^ajax/invite_friend$ ajax_invite_friend.php
RewriteRule ^ajax/send_message$ ajax_send_message.php
RewriteRule ^ajax/rate_user$ ajax_rate_user.php
RewriteRule ^ajax/remove_friend$ ajax_remove_friend.php
RewriteRule ^ajax/accept_friend$ ajax_accept_friend.php
RewriteRule ^ajax/reject_friend$ ajax_reject_friend.php
RewriteRule ^ajax/category_videos$ ajax_category_videos.php
RewriteRule ^ajax/users$ ajax_users.php
RewriteRule ^ajax/blog_comment$ ajax_blog_comment.php
RewriteRule ^ajax/blog_pagination$ ajax_blog_pagination.php
RewriteRule ^ajax/blog_comment_delete$ ajax_blog_comment_delete.php
RewriteRule ^blog/add$ blog_add.php
RewriteRule ^blog/edit/(.*)/(.*) blog_edit.php?bid=$1&title=$2
RewriteRule ^blog/delete/(.*) blog_delete.php?bid=$1
RewriteRule ^blog/(.*)/(.*) viewblog.php?bid=$1&title=$2
RewriteRule ^ajax/blog_preview$ ajax_blog_preview.php
RewriteRule ^blogs$ blogs.php
RewriteRule ^invite$ invite.php
RewriteRule ^feedback$ feedback.php
RewriteRule ^static/faq$ faq.php
RewriteRule ^static/terms$ terms.php
RewriteRule ^static/privacy$ privacy.php
RewriteRule ^static/dmca$ dmca.php
RewriteRule ^static/_2257$ 2257.php
RewriteRule ^static/webmasters$ webmasters.php
RewriteRule ^static/advertise$ advertise.php
RewriteRule ^notices$ notices.php
RewriteRule ^notice/(.*)/(.*) viewnotice.php?nid=$1&title=$2
RewriteRule ^ajax/notice_comment$ ajax_notice_comment.php
RewriteRule ^ajax/notice_pagination$ ajax_notice_pagination.php
RewriteRule ^ajax/notice_comment_delete$ ajax_notice_comment_delete.php
RewriteRule ^blocks$ blocks.php
RewriteRule ^delete$ delete.php
RewriteRule ^download/video/(.*)/(.*) downloadvideo.php?VIDEOID=$1&title=$2
RewriteRule ^rss$ rss.php
RewriteRule ^photos$ photos.php
</IfModule>
<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off
# The below probably isn't needed,
# but better safe than sorry.
SecFilterScanPOST Off
</IfModule>