Hôm qua tôi đã nâng cấp lên Yosemite và giờ đây cấu hình cục bộ của tôi để phát triển web không hoạt động nữa.Cấu hình Apache bị hỏng sau khi nâng cấp lên Yosemite
Tôi đã quản lý để thiết lập userdir theo /Users/user/public_html
và tôi có thể truy cập tất cả các trang web qua localhost/~user/websitename
. Không có gì đặc biệt, nhưng tôi mất một thời gian để cấu hình.
Tìm trong thư mục apache Tôi thấy rằng nhiều tệp đã được thay thế, giữ một bản sao lưu. Tôi đã thử đặt lại các tập tin với các thiết lập của tôi một lần nữa, nhưng vẫn không hoạt động. Có lẽ tôi đang thiếu một số tập tin mà tôi không nhớ.
Đây là httpd-userdir.conf:
# Settings for user home directories
#
# Required module: mod_userdir
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received. Note that you must also set
# the default access control for these directories, as in the example below.
#
UserDir public_html
#
# Users might not be in /Users/*/Sites, so use user-specific config files.
#
Include /private/etc/apache2/users/*.conf
<IfModule bonjour_module>
RegisterUserSite customized-users
</IfModule>
<Directory "/Users/*/public_html/">
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Order allow,deny
Allow from all
</Directory>
Sau đó, trong http.conf tôi đã kích hoạt một số module:
Include /private/etc/apache2/extra/httpd-userdir.conf
LoadModule userdir_module libexec/apache2/mod_userdir.so
và điều này:
DocumentRoot "/ Users/user/public_html "
Directory "/Users/user/public_html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks MultiViews
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
Nếu tôi chỉ đơn giản là cố gắng truy cập localhost
, nó sẽ hiển thị thông báo "Nó hoạt động!". Nếu tôi truy cập localhost/user
chỉ đơn giản là không tải và giống nhau nếu tôi cố truy cập một trong các trang web.
Tôi có bỏ lỡ bất kỳ tệp nào không? Trong nhật ký apache nó thậm chí không hiển thị bất kỳ lỗi nào.
Nâng cấp Yosemite Apache từ 2,2 lên 2,4. Cấu hình đã thay đổi. Bạn đã bật mô-đun mod_userdir chưa? Ngoài ra, bạn sẽ muốn thay đổi chỉ thị "Đơn hàng" và "Cho phép" của mình. Bạn có thể muốn xem lại các nguyên tắc nâng cấp http://httpd.apache.org/docs/2.4/upgrading.html –
Người đọc trong tương lai có thể muốn bắt đầu với [cài đặt Apache, PHP và MySQL trên Mac OS X Yosemite] (http: //jason.pureconcepts.net/2012/10/install-apache-php-mysql-mac-os-x/) cách * đúng cách *. –
Ngoài ra, hãy đọc [https://discussions.apple.com/thread/6602475#26885389] (https://discussions.apple.com/thread/6602475#26885389) – luisnicg