I have a pretty weird nginx setup. I need the following setup:
<ul>
<li>url "/" -> static html files in /srv/www/landing-pages</li>
<li>url "/tr_tr/blog/*" -> wordpress installation in /srv/www/domain.com</li>
<li>url "/en_us/blog/*" -> wordpress installation in /srv/www/domain.com</li>
</ul>
The wordpress configuration is like
<ul>
<li>currently the wordpress installation is configured to answer to domain.com. </li>
<li>the whole /tr_tr/blog structure is constructed with wpml multi language plugin. </li>
<li>two wordpress pages are created with "/blog" slug and are prefixed with locales by the wpml plugin. </li>
<li>Blog post permalinks are set to /blog/%postname%-%post_id%/ Those permalinks are prefixed with locales by wpml automatically too.</li>
</ul>
My nginx configuration is
I added only tr_tr location during development. Currently I'm getting 404's 403's "No input file specified's" for blog urls.
Root urls are fine, I can open my dummy html files in srv/www/landing-pages folder from domain.com/test.html
The idea is,
<ul>
<li>all urls should follow /{locale}/{project} template. </li>
<li>corporate landing pages will be served from landing-pages folder (gatsbyjs)</li>
<li>Company blog is served from /{locale}/blog urls</li>
<li>I dont want to create two seperate wp installations for both countries.</li>
</ul>
How can I setup this configuration in nginx?
<ul>
<li>url "/" -> static html files in /srv/www/landing-pages</li>
<li>url "/tr_tr/blog/*" -> wordpress installation in /srv/www/domain.com</li>
<li>url "/en_us/blog/*" -> wordpress installation in /srv/www/domain.com</li>
</ul>
The wordpress configuration is like
<ul>
<li>currently the wordpress installation is configured to answer to domain.com. </li>
<li>the whole /tr_tr/blog structure is constructed with wpml multi language plugin. </li>
<li>two wordpress pages are created with "/blog" slug and are prefixed with locales by the wpml plugin. </li>
<li>Blog post permalinks are set to /blog/%postname%-%post_id%/ Those permalinks are prefixed with locales by wpml automatically too.</li>
</ul>
My nginx configuration is
Code:
server {
server_name www.domain.com;
return 301 $scheme://domain.com$request_uri;
}
Code:
server {
listen 80;
listen [::]:80;
server_name domain.com;
return 301 https://$server_name$request_uri;
}
Code:
server {
listen 443 ssl;
server_name domain.com;
gzip on;
gzip_proxied any;
gzip_types
text/plain
text/xml
text/css
image/svg+xml
application/json
application/javascript
application/x-javascript;
gzip_vary on;
gzip_disable “MSIE [1-6]\.(?!.*SV1)”;
expires $expires;
ssl_certificate /etc/nginx/ssl/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
server_tokens off;
# include /etc/nginx/nginx-wp-common.conf;
location / {
root /srv/www/landing-pages;
index index.html index.htm;
try_files $uri $uri/ /$uri;
}
location /tr_tr/blog {
alias /srv/www/domain.com/;
index index.php;
try_files $uri $uri/ /index.php?$args =404;
location ~ \/tr_tr\/blog\/.*\.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_read_timeout 3600s;
fastcgi_param SCRIPT_FILENAME /srv/www/domain.com/$fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
}
}
}
I added only tr_tr location during development. Currently I'm getting 404's 403's "No input file specified's" for blog urls.
Root urls are fine, I can open my dummy html files in srv/www/landing-pages folder from domain.com/test.html
The idea is,
<ul>
<li>all urls should follow /{locale}/{project} template. </li>
<li>corporate landing pages will be served from landing-pages folder (gatsbyjs)</li>
<li>Company blog is served from /{locale}/blog urls</li>
<li>I dont want to create two seperate wp installations for both countries.</li>
</ul>
How can I setup this configuration in nginx?