Difference between revisions of "Talk:Nginx"

From ArchWiki
Jump to: navigation, search
(Bash Script for the Whole Setup: new section)
(5 intermediate revisions by 5 users not shown)
Line 3: Line 3:
 
After reading [http://library.linode.com/lemp-guides/ubuntu-10.04-lucid/#deploy_php_with_fastcgi this], why isn't the example in this wiki set to use the "http" user instead of root.
 
After reading [http://library.linode.com/lemp-guides/ubuntu-10.04-lucid/#deploy_php_with_fastcgi this], why isn't the example in this wiki set to use the "http" user instead of root.
  
In step 3 for PHP  
+
== In step 3 for PHP ==
 
the folder /srv/http/nginx does not exist. It should be /usr/share/nginx/http shouldn't it?
 
the folder /srv/http/nginx does not exist. It should be /usr/share/nginx/http shouldn't it?
 +
 +
== systemd fails to start php-fpm with settings in this article ==
 +
 +
systemd gave error "Failed to get D-Bus connection". To fix, change the following in /etc/php/php-fpm.conf :
 +
 +
;error_log = log/php-fpm.log
 +
to
 +
error_log = /var/log/php-fpm.log
 +
 +
Not sure if this is confirmed, but seems to be common.  Source: [http://www.howtoforge.com/installing-nginx-with-php5-and-php-fpm-and-mysql-support-on-opensuse-12.1 Installing Nginx With PHP5]
 +
 +
Does anybody with wikiskills want to make the changes?  I am new to wiki editing.
 +
: Check [[Help:Editing]] and [[Help:Style]], it is a good opportunity to get involved. -- [[User:Fengchao|Fengchao]] ([[User talk:Fengchao|talk]]) 05:54, 20 March 2013 (UTC)
 +
 +
== Running nginx jailed ==
 +
 +
Wouldn't be better to use systemd's {{ic|RootDirectory=}} {{ic|User=}} & {{ic|Group=}} Options in the {{ic|[Service]}} section instead of running each {{ic|Exec*}} with {{ic|chroot}}?
 +
 +
{{hc|/etc/sistemd/system/nginx.service|
 +
[Unit]
 +
Description=A high performance web server and a reverse proxy server
 +
After=syslog.target network.target
 +
 +
[Service]
 +
Type=forking
 +
RootDirectory=/srv/http
 +
User=http
 +
Group=http
 +
PIDFile=/run/nginx.pid
 +
ExecStartPre=/usr/sbin/nginx -t -q -g 'pid /run/nginx.pid; daemon on; master_process on;'
 +
ExecStart=/usr/sbin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;'
 +
ExecReload=/usr/sbin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;' -s reload
 +
ExecStop=/usr/sbin/nginx -g 'pid /run/nginx.pid;' -s quit
 +
 +
[Install]
 +
WantedBy=multi-user.target}}
 +
 +
Also Jail's {{ic|/tmp}} and {{ic|/run}} tmpfs should be added to fstab for the service to load on reboot.
 +
 +
== stanza is wrong ==
 +
 +
the stanza refers to 'index.php', but it should refer to the proper PHP path --[[User:Legolas558|Legolas558]] ([[User talk:Legolas558|talk]]) 06:23, 14 May 2013 (UTC)
 +
 +
== Bash Script for the Whole Setup ==
 +
 +
I've created a bash script to run all the steps in the setup described in the main article:
 +
 +
https://gist.github.com/adityamukho/7365731
 +
 +
This can be used as is, for 64-bit systems. For 32-bit systems, a few modifications need to be made, esp line 41.

Revision as of 03:30, 8 November 2013

Run FastCGI as user, not root.

After reading this, why isn't the example in this wiki set to use the "http" user instead of root.

In step 3 for PHP

the folder /srv/http/nginx does not exist. It should be /usr/share/nginx/http shouldn't it?

systemd fails to start php-fpm with settings in this article

systemd gave error "Failed to get D-Bus connection". To fix, change the following in /etc/php/php-fpm.conf :

;error_log = log/php-fpm.log

to

error_log = /var/log/php-fpm.log

Not sure if this is confirmed, but seems to be common. Source: Installing Nginx With PHP5

Does anybody with wikiskills want to make the changes? I am new to wiki editing.

Check Help:Editing and Help:Style, it is a good opportunity to get involved. -- Fengchao (talk) 05:54, 20 March 2013 (UTC)

Running nginx jailed

Wouldn't be better to use systemd's RootDirectory= User= & Group= Options in the [Service] section instead of running each Exec* with chroot?

/etc/sistemd/system/nginx.service
[Unit]
Description=A high performance web server and a reverse proxy server
After=syslog.target network.target

[Service]
Type=forking
RootDirectory=/srv/http
User=http
Group=http
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -q -g 'pid /run/nginx.pid; daemon on; master_process on;'
ExecStart=/usr/sbin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;'
ExecReload=/usr/sbin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;' -s reload
ExecStop=/usr/sbin/nginx -g 'pid /run/nginx.pid;' -s quit

[Install]
WantedBy=multi-user.target

Also Jail's /tmp and /run tmpfs should be added to fstab for the service to load on reboot.

stanza is wrong

the stanza refers to 'index.php', but it should refer to the proper PHP path --Legolas558 (talk) 06:23, 14 May 2013 (UTC)

Bash Script for the Whole Setup

I've created a bash script to run all the steps in the setup described in the main article:

https://gist.github.com/adityamukho/7365731

This can be used as is, for 64-bit systems. For 32-bit systems, a few modifications need to be made, esp line 41.