配置文件:
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
root /var/www/html;
index index.php index.html index.htm;
server_name localhost;
location / {
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
curl -I mylocalwebsite.ddns.net
HTTP/1.1 301 Moved Permanently
Server: nginx/1.4.6 (Ubuntu)
Date: Wed, 19 Oct 2016 10:36:14 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.5.9-1ubuntu4.20
Set-Cookie: PHPSESSID=ku8vc501u9srdeqh08cnsdvht6; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://localhost/
文件:/var/log/nginx/access.log
85.105.338.54 - - [19/Oct/2016:12:38:25 +0200] "HEAD / HTTP/1.1" 301 0 "-" "curl/7.35.0"
答案 0 :(得分:1)
Wordpress在其配置中有静态域名,如果您将其设置为localhost,并使用指向您的wordpress安装的IP或其他域名访问它,它将重定向到localhost。
您是否尝试在设置中设置wordpress域名,与您的noip域名相同? (例如,mylocalwebsite.ddns.net)。在你的wordpress设置上检查它。
答案 1 :(得分:0)
将mylocalwebsite.ddns.net
设置为您的server_name指令,您的nginx将能够响应您对该主机的请求。