Welcome! Log In Create A New Profile

Advanced

Nginx: how to set a static site with its blog inside a folder

Posted by javipas 
Nginx: how to set a static site with its blog inside a folder
March 24, 2011 04:31AM
Hi,

I'm setting up a web page that has a static part and a dynamic part. Suppose the site is in the root folder of my virtualhost, in this case, the structure is as follows

/mysite/
\_____index.php
\____actualidad/

I'm trying to be able to work on the dynamic part without problems, but I'm making some mistake. Inside the "actualidad" folder I have a **normal WordPress blog**. Nothing else. Although I can access both the static part (http://www.mysite.com) and the dynamic part (http://www.mysite.com/actualidad) **I can't access to the WordPress backend**. Each time I try to get into it I get either on the dynamic part, or I get an error.

My nginx configuration file for this site is as follows:

************* BEGINNING OF CONFIG FILE ****************

server {
server_name www.mysite.com;
rewrite ^(.*) http://mysite.com$1 permanent;
}

server {
listen 80;
server_name mysite.com;

access_log /var/www/mysite/log/access.log;
error_log /var/www/mysite/log/error.log info;

index index.php;

location / {
set $php_root /var/www/mysite;
try_files $uri $uri/ /index.php?q=$uri&$args;
}

location /actualidad {
set $php_root /var/www/mysite;
try_files $uri $uri/ /actualidad/index.php?q=$uri&$args;
}

## Images and static content is treated differently

location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|\
rtf|js)$ {
access_log off;
expires 30d;
root /var/www/mysite;
}

location ~* \.php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort on;
fastcgi_read_timeout 180;
}


## Disable viewing .htaccess & .htpassword
location ~ /\.ht {
deny all;
}

}

upstream backend {
server 127.0.0.1:9000;

}

******************* END OF FILE **************

I know there is some mistake there, but... where? What I want is to be able to differentiate the static index.php at the root and my WP folder with the blog, that I should be able to access both the frontend (I can access it now) and the backend (which I can't get access into).
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 200
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready