安裝apache後,修改httpd.conf文件html
將根目錄修改成你圖片所在目錄apache
DocumentRoot有這麼一行,修改爲你要指向的路徑
DocumentRoot "/yang/pic" 個人路徑
再修改一下 Directory的路徑 要求和上邊的一致ide
<Directory "/yang/pic"> # # 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 FollowSymLinks # # 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>
接下來是權限的設置,由於完成上邊的設置後,若是訪問你的圖片路徑,是可以看到目錄下全部圖片等文件的。this
因此要求他不能訪問路徑spa
進入apache的配置文件 httpd.conf 找到: 在 配置訪問目錄處設置code
Options Indexes FollowSymLinks 修改成: Options FollowSymLinks
這樣在 yang/pic 目錄下的圖片 就能夠經過地址訪問了orm
通常默認的端口爲80,能夠經過配置文件修改,server
Listen 81 找到這個位置,我改爲了81端口