• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

How to enable nginx for all domains?

nurullah_me"><hr>

New Pleskian
Hi friends,

I have installed the nginx on my server and want to activate it for all my domains, to do this, i have to do it manually for each domains. But there should be an easier way. Apache uses too much ram.
Could you show me please a way?

Thanks
 
Run /usr/local/psa/bin/domain --help and select needed nginx mode:

-nginx-transparent-mode <true|false>
Turns on/off the transparent mode for
the nginx reverse proxy server. In
this mode, Apache handles both static
and dynamic content, while nginx only
passes HTTP requests and responses
without modification. The default
value is "false".
-nginx-serve-static <true|false> Turns on/off serving static content by
the nginx reverse proxy server. The
default value is "false".
-nginx-static-extensions <extensions>
Sets static files extensions that
should be served directly by nginx. If
you specify an empty value, the static
files extensions from the default
nginx configuration
(/var/www/vhosts/domain1.tld/.plesk/conf/last_nginx.conf)
will be used. Use this option with the
-nginx-serve-static command.
-nginx-serve-php <true|false> Turns on/off processing PHP files by
the nginx reverse proxy server. The
default value is "false".

After that use script like:

# for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select name from domains"`; do /usr/local/psa/bin/domain -u $i -nginx-serve-static true;done

add there needed option for nginx mode.
 
Run /usr/local/psa/bin/domain --help and select needed nginx mode:

-nginx-transparent-mode <true|false>
Turns on/off the transparent mode for
the nginx reverse proxy server. In
this mode, Apache handles both static
and dynamic content, while nginx only
passes HTTP requests and responses
without modification. The default
value is "false".
-nginx-serve-static <true|false> Turns on/off serving static content by
the nginx reverse proxy server. The
default value is "false".
-nginx-static-extensions <extensions>
Sets static files extensions that
should be served directly by nginx. If
you specify an empty value, the static
files extensions from the default
nginx configuration
(/var/www/vhosts/domain1.tld/.plesk/conf/last_nginx.conf)
will be used. Use this option with the
-nginx-serve-static command.
-nginx-serve-php <true|false> Turns on/off processing PHP files by
the nginx reverse proxy server. The
default value is "false".

After that use script like:

# for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select name from domains"`; do /usr/local/psa/bin/domain -u $i -nginx-serve-static true;done

add there needed option for nginx mode.


Thanks, but i didn't understand how to use this script.
I'm not so good in SSH :/ i run the command

/usr/local/psa/bin/domain nginx-transparent-mode

but i get error. which script should i use, to enable nginx for all domains?
 
Just copy-paste this line in CLI and press Enter:

for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select name from domains"`; do /usr/local/psa/bin/domain -u $i -nginx-transparent-mode true;done

Of course if you need nginx transparent mode.
 
Just copy-paste this line in CLI and press Enter:

for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select name from domains"`; do /usr/local/psa/bin/domain -u $i -nginx-transparent-mode true;done

Of course if you need nginx transparent mode.
I think it didnt solve my problem.

I see now in the domain panel that nginx is still not checked.

So still running apache. I want the completly disable apache.

Am i doing something false?

I used the script which you wrote in your last post.

Please also see the attachment that nginx is still not active for domains.
 

Attachments

  • Bildschirmfoto 2014-11-20 um 17.04.32.png
    Bildschirmfoto 2014-11-20 um 17.04.32.png
    116.3 KB · Views: 1
It is not possible in Plesk completely disable apache. A lot of different webhosting features in Plesk connected with Apache. Nginx can work in different modes together with Apache but not standalone for webhosting.
 
Back
Top