Welcome! Log In Create A New Profile

Advanced

Serving wordpress from subdomain

May 15, 2014 10:38PM
My setup is nginx + php-fpm. I am running a web application on domain.com and I am serving a wordpress configuration from domain.com/blog.

The problem is that the web app is served from /var/www/domain/html/http and wordpress is located outside of the root directory: /var/www/domain/html/blog
How can I serve the blog effectively? I did try to symlink /blog from within the root but I feel this is a bad solution.

Here is my configuration file:

server {
listen *:80;
listen 443 ssl;
server_name domain;
error_log /var/www/domain/logs/error_log warn;
ssl_certificate /etc/nginx/certs/domain.crt;
ssl_certificate_key /etc/nginx/certs/domain.key;
ssl_ciphers RC4:HIGH:!aNULL:!MD5:!kEDH;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
root /var/www/domain/html/http;
index index.php;
client_max_body_size 250m;

location / {
try_files $uri $uri/ /index.php?$args;
}
location /blog {
root /var/www/domain/html;
try_files $uri $uri/ /blog/index.php?q=$1;
}
location ~ \.php(/|$) {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SERVER_NAME $http_host;
fastcgi_pass 127.0.0.1:9000;
}
location ~* ^.+\.(ht|svn)$ {
deny all;
}

# Static files location
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)$ {
expires max;
}
}
Subject Author Posted

Serving wordpress from subdomain

adambenayoun May 15, 2014 10:38PM

Re: Serving wordpress from subdomain

Alan Chandler May 16, 2014 01:12AM

Re: Serving wordpress from subdomain

Francis Daly May 18, 2014 04:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 69
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready