Php 在Nginx的子目录中安装wordpress
我正在tomcat上运行一个网站,我想将我的博客设置在example.com/blog所在网站的子目录下 我尝试使用多种设置,但都不起作用。有些给出502错误,有些给出404错误,下面的配置没有给出指定的输入文件错误 我正在子域上成功运行此博客,配置如下:Php 在Nginx的子目录中安装wordpress,php,wordpress,nginx,Php,Wordpress,Nginx,我正在tomcat上运行一个网站,我想将我的博客设置在example.com/blog所在网站的子目录下 我尝试使用多种设置,但都不起作用。有些给出502错误,有些给出404错误,下面的配置没有给出指定的输入文件错误 我正在子域上成功运行此博客,配置如下: server { listen 80; root /home/myubuntu/www/blog; index index.php index.html index.htm; server_name blog
server {
listen 80;
root /home/myubuntu/www/blog;
index index.php index.html index.htm;
server_name blog.example.com;
gzip on;
location / {
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;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
有人能告诉我,我做错了什么吗?在搜索组合设置和搜索两天后,我发现了相同的问题。。。我做了一些对我有用的东西。 我正在运行nginx1.8 Wordpress。。。老实说,我不知道 这是我的配置
server {
listen 80;
server_name www.example.com example.com;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
location / {
root /http;
index index.php index.html index.htm;
try_files $uri $uri/ @wordpress;
}
location ~ \.php$ {
root /http/wordpress;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location @wordpress {
try_files $uri /index.php;
fastcgi_intercept_errors on;
}
location /wordpress {
try_files $uri $uri/ @wordpress;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
}
我希望这对您有所帮助…以下是设置路径:
etc/nginx/sites-availability/default
您需要使用wordpress遵循nginx中的最小设置。完成此设置后,您需要重新启动这两项服务。之后,您的网站工作正常。如果仍然需要问题,请与我们共享。
server {
listen 80;
root /var/www/html;
index index.php;
server_name 182.71.214.253;
location /blogs {
try_files $uri $uri/ /blogs/index.php?$args;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
#root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on the php-fpm socket
location ~ \.php$ {
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;
}} </code> </pre> After this settings,You need to restart the two services.<pre><code>1:NGINX : sudo service nginx restart<br/>2:php5-fpm : sudo service php5-fpm restart</code></pre><br/>After that your website is working fine.<br/>If still needs problem then share with us.
任何人都可以管理此代码,即删除HTML标记“code”,并以系统的方式进行预处理和管理。因为这是一个经过测试的代码,工作正常。
server {
listen 80;
root /var/www/html;
index index.php;
server_name 182.71.214.253;
location /blogs {
try_files $uri $uri/ /blogs/index.php?$args;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
#root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on the php-fpm socket
location ~ \.php$ {
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;
}} </code> </pre> After this settings,You need to restart the two services.<pre><code>1:NGINX : sudo service nginx restart<br/>2:php5-fpm : sudo service php5-fpm restart</code></pre><br/>After that your website is working fine.<br/>If still needs problem then share with us.