• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

wordpress mu 3.6 ( or also 3.5.2) nginx issue

JacopoL

New Pleskian
Hi i have big problem with wordpress mu 3.6 ( but also 3.5.2) problem is the same

i have a Mediatmple server DV 4.0 with centos 5.8 and i have installed wpmu with subdomain without problem.
the problem is Nginx when is active (that i want) the upload media of wp give me problem of 404 nginx

http://templateblog.builtinsite.com/wp-content/uploads/sites/2/2013/08/psd-clipboard-icon.png

i check in log file

the path that nginx has is /var/www/vhosts/avusy.com/wp-content/uploads/sites/2 etc...

avusy.com is the primary domain, the domain that was set when i buy the server :(

to enable to work on subdomain with plesk 11.0.9 i have create a vhost.conf in my builtinste.com domain (that have his plesk webspace) adding this:

ServerAlias "*.builtinsite.com"

<Directory /var/www/vhosts/builtinste.com/>
AllowOverride FileInfo Options
</Directory>

/usr/local/psa/admin/sbin/httpdmng --reconfigure-all

and subdomain works but when you register a new blog you see that 4 example http://templateblog.builtinsite.com doesn't load css and image and if you upload a media in wp media uploader you obtain the thumbnail with question mark and the link give 404

i see that there is nginx.conf and nginx.comf.default files in etc/nginx what file i must edit?

how can redirect to correct domain? i have read that if i have plesk procedure could be templates based.

i have no directory sites-enable and sites-availabe as this link said:

http://stackoverflow.com/questions/17413526/nginx-missing-sites-available-directory

so if i want to keep plesk in right way updated evrything without pain how procedure must i follow?

thx.

J.
 
yes i have fixed the problem, in short :

1 ) create a custom template (nginx) on plesk by terminal (u can check in parallels plesk about how configure vhost with custom templates)
2 ) add to your custom template the following lines at the beginning:

<?php if (file_exists($VAR->domain->physicalHosting->vhostDir . '/conf/nginx.conf')): ?>
include <?php echo $VAR->domain->physicalHosting->vhostDir;?>/conf/nginx.conf;
<?php endif ?>

regenerate the configuration files with the command :

Generate new configuration files:
# httpdmng <command>
Where <command> is one of the following:
--reconfigure-server generates sever-wide configuration files.
--reconfigure-domain <domain-name> generates files for a specified domain.
--reconfigure-all generates all configuration files.

3) create nginx.conf file by terminal inside your var/www/vhosts/yourdomain/conf/ and add this configuration:

map $http_host $blogid {
default -999;
include /var/www/vhosts/yourdomain/httpdocs/wp-content/uploads/nginx-helper/map.conf;
}

server {
error_log /var/log/nginx/vhost-error_log warn;
listen yourip:80;
server_name yourdomain.com *.yourdomain.com;
# access_log /usr/local/apache/domlogs/churchpr.es-bytes_log bytes_log;
# access_log /usr/local/apache/domlogs/churchpr.es combined;
root /var/www/vhosts/yourdomain/httpdocs;
index index.php index.html index.htm;

location / {
location ~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
expires 30d;
try_files $uri $uri/ /index.php?$args;
}

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

error_page 405 = @backend;
add_header X-Cache HIT from Backend;
proxy_pass http://yourip:7081;
include /var/www/vhosts/yourdomain/conf/proxy.conf;
}
location @backend {
internal;
proxy_pass http://yourip:7081;
include /var/www/vhosts/yourdomain/conf/proxy.conf;
}
location ~ .*\.(php|jsp|cgi|pl|py)?$ {
proxy_pass http://yourip:7081;
include /var/www/vhosts/yourdomain/conf/proxy.conf;
}
location ~ /\.ht {
deny all;
}

location ~ \.php$ {
try_files $uri @wordpress;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://yourip:7081;
}

location ~ ^/files/(.*)$ {
try_files /wp-content/uploads/sites/$blogid/ $uri/wp-includes/ms-files.php?file=$1;
access_log off; log_not_found off; expires max;
}

location ^~ /sites {
internal;
alias /var/www/vhosts/yourdomain/httpdocs/wp-content/uploads/sites;
access_log off; log_not_found off; expires max;
}

}

4) create file proxy.conf

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;

5) restart nginx and apache e voila

IMPORTANT: check in vhost file your apache port in my mediatemple dv 4.0 i have 7081 but could be different in your configuration
 
Back
Top