cari

Rumah  >  Soal Jawab  >  teks badan

MAC, konfigurasikan sistem supaya disertakan dengan hos maya apache dan 404 muncul.

Seperti yang dinyatakan, berikut ialah kod utama fail konfigurasi saya, tolong bantu saya menyemaknya
Berikut adalah sebahagian daripada kod httpd.conf:

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used.  If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "/usr"
...
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
#
<Directory />
    Options  Indexes  FollowSymLinks
    AllowOverride None
    Allow from all 
</Directory>
...
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Users/bjhl/myServer"
<Directory "/Users/bjhl/myServer">
    #
    # 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.4/mod/core.html#options
    # for more information.
    #
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Require all granted

</Directory>
...

Berikut ialah httpd-vhosts.conf:

<VirtualHost *:80>
    ServerAdmin www.YYServer.com
    DocumentRoot "Users/bjhl/myServer"
    ServerName www.YYServer.com
    ServerAlias YYServer
    ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
    CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common
    <Directory "/Users/bjhl/myServer">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

Akhirnya menjadi tuan rumah:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1    localhost
127.0.0.1    www.YYServer.com
255.255.255.255    broadcasthost
::1             localhost 
phpcn_u1582phpcn_u15822750 hari yang lalu777

membalas semua(1)saya akan balas

  • 習慣沉默

    習慣沉默2017-05-16 17:00:00

    Ia telah disusun, tetapi saya tidak tahu mengapa ia tidak berfungsi sebaik sahaja saya memperkenalkan hos maya, dan akhirnya saya tidak mengkonfigurasi hos maya sebenarnya, penyelesaiannya sangat mudah, bahagian yang diubah suai ditampal seperti berikut :

    #
    # Deny access to the entirety of your server's filesystem. You must
    # explicitly permit access to web content directories in other 
    # <Directory> blocks below.
    #
    <Directory />
        AllowOverride none
        Require all granted
    </Directory>
    ...
    DocumentRoot "/Users/bjhl/myServer"
    <Directory "/Users/bjhl/myServer">
        #
        # 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.4/mod/core.html#options
        # for more information.
        #
        Options Indexes FollowSymLinks Multiviews
        MultiviewsMatch Any
    
        #
        # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   AllowOverride FileInfo AuthConfig Limit
        #
        AllowOverride None
    
        #
        # Controls who can get stuff from this server.
        #
        Require all granted
    </Directory>

    Selain itu, kita perlu

    LoadModule php5_module libexec/apache2/libphp5.so

    Nyahkomen baris kod ini dan masukkannya dalam terminal

    cd /etc
    sudo cp php.ini.default php.ini

    Itu sahaja

    balas
    0
  • Batalbalas