你這個問題主要是配置web服務器和反向代理
成都創(chuàng)新互聯(lián)公司是專業(yè)的潢川網(wǎng)站建設公司,潢川接單;提供網(wǎng)站制作、成都網(wǎng)站設計,網(wǎng)頁設計,網(wǎng)站設計,建網(wǎng)站,PHP網(wǎng)站建設等專業(yè)做網(wǎng)站服務;采用PHP框架,可快速的進行潢川網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團隊,希望更多企業(yè)前來合作!
舉例如下:
server {
listen 8080;
server_name localhost;
location / {
root 網(wǎng)站根目錄;
index index.htm index.php index.html;
}
location /phpadmin {
root phpadmin目錄;
index index.html index.php;
}
}
用的是Apache 2.2 / Linux Mint13 / wordpress 3.4.1.
網(wǎng)上的解決辦法都說只要在文件/etc/apache2/ports.conf中添加如下行:
NameVirtualHost *:1234
Listen 1234
然后在目錄/etc/apache2/sites-available為wordpress站點新建一個virtual host:
VirtualHost *:1234
ServerName wordpress.com
ServerAdmin webmaster@wordpress.com
DocumentRoot /home/tristan/workspace/wordpress
Directory /
Options FollowSymLinks
AllowOverride None
/Directory
Directory /home/tristan/workspace/wordpress/
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
/Directory
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
Directory "/usr/lib/cgi-bin"
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
/Directory
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
Directory "/usr/share/doc/"
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
/Directory
/VirtualHost
然后把wordpress.com名稱解析添加到/etc/hosts文件中,
127.0.0.1 wordpress.com
這樣當域名解析時會直接把wordpress.com解析為127.0.0.1,而不是公網(wǎng)上的那個真正的wordpress官網(wǎng)的IP地址。
我試了以后在瀏覽器中輸入,仍然收到301 (permanent removed)錯誤代碼,然后直接跳轉(zhuǎn)到apache服務器的默認index頁面。
這個需要打開瀏覽器的腳本debugger,然后檢測請求發(fā)送與響應。
然后,我用netstat檢測端口有沒有打開,發(fā)現(xiàn)端口已經(jīng)打開了。
然后我又用telnet嘗試連接,
telnet 1234
GET / HTTP/1.0
(注意,輸完后要按兩次回車)
可以得到響應。
開始一直以為apache2沒配對,看了那個官方文檔,英文的,中文的都看了,沒發(fā)現(xiàn)有啥不對勁。后來又懷疑端口是不是有問題,換了其他端口,也沒發(fā)現(xiàn)問題。
在網(wǎng)上找了半天,終于發(fā)現(xiàn)是wordpress的配置8對。天殺的,網(wǎng)上的那些答案太抽象了。
原來要再wp-config.php文件中修改兩個變量的值:
define('WP_SITEURL', '');
define('WP_HOME', '');
這兩個全局變量需要比較新的wordpress,應該版本大于2.2哈。如果不是的話,那就直接修改數(shù)據(jù)庫中表wp_options。
update wp_options set option_value=N'' where option_name='siteurl';
update wp_options set option_value=N'' where option_name='home';
你的服務器 IP 地址后面為什么要帶上端口號呢?網(wǎng)站默認一般是 80 端口??刺崾静痪褪沁@個問題嗎?
要解決的話需要先搞清楚你為什么不直接用 IP 做主機地址而要在 IP 后面指定端口地址 9000。莫非你這個網(wǎng)站只是內(nèi)部測試用的?
當前文章:wordpress多端口 wordpress多站點設置
分享地址:http://muchs.cn/article18/doespdp.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、動態(tài)網(wǎng)站、靜態(tài)網(wǎng)站、響應式網(wǎng)站、全網(wǎng)營銷推廣、外貿(mào)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)