wlan 上的 Nginx 仅传递索引文件
Nginx on wlan passing only index file
我在 Nginx 上有一个本地 Wordpress 站点 运行ning。
我想做的是通过 Wlan 使其 运行,到目前为止我已经做到了:
1. Made site running on local computer.
2. Run the site on other computer that is connected to the same router.
问题是,当我尝试 运行 在其他计算机上访问此站点时,它仅提供索引文件。
我尝试运行网站的电脑ip是192.xxx.x.1,服务器ip是192.xxx.x.3
来自 192.xxx.x.1 机器的浏览器错误:
GET http://localhost/wp-content/themes/wpbootstrap/style.css
我如何配置 Nginx,以便当我 运行 在本地服务器机器之外的站点时,它从
获取所有文件
192.xxx.x.3/wp-content/themes/wpbootstrap/style.css*
而不是
localhost/wp-content/themes/wpbootstrap/style.css*
我的 Nginx 站点配置:
server {
listen 192.xxx.x.3:80;
root /usr/share/nginx/wordpress;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/wordpress;
}
# pass the PHP scripts to FastCGI server listening on the php-fpm socket
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
It looks like a WordPress problem. Have you set SITE URL and HOME to
localhost? – Richard Smith 20 hours ago
我在 Nginx 上有一个本地 Wordpress 站点 运行ning。 我想做的是通过 Wlan 使其 运行,到目前为止我已经做到了:
1. Made site running on local computer.
2. Run the site on other computer that is connected to the same router.
问题是,当我尝试 运行 在其他计算机上访问此站点时,它仅提供索引文件。
我尝试运行网站的电脑ip是192.xxx.x.1,服务器ip是192.xxx.x.3
来自 192.xxx.x.1 机器的浏览器错误:
GET http://localhost/wp-content/themes/wpbootstrap/style.css
我如何配置 Nginx,以便当我 运行 在本地服务器机器之外的站点时,它从
获取所有文件192.xxx.x.3/wp-content/themes/wpbootstrap/style.css*
而不是
localhost/wp-content/themes/wpbootstrap/style.css*
我的 Nginx 站点配置:
server {
listen 192.xxx.x.3:80;
root /usr/share/nginx/wordpress;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/wordpress;
}
# pass the PHP scripts to FastCGI server listening on the php-fpm socket
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
It looks like a WordPress problem. Have you set SITE URL and HOME to localhost? – Richard Smith 20 hours ago