Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some issues with the new version #1

Open
ovizii opened this issue Jun 8, 2011 · 21 comments
Open

some issues with the new version #1

ovizii opened this issue Jun 8, 2011 · 21 comments

Comments

@ovizii
Copy link

ovizii commented Jun 8, 2011

I am referring to this version: https://github.com/Xeoncross/lowendscript but it seems one can't post issues there. Besides issues I also have some simple questions as:

Can you explain this in more detail? First, I added sample MVC framework (everything through index.php) and normal PHP (all php files allowed) configurations to nginx. These allow much cleaner site configs.

Also what exactly is the point of these two files: nginx installed for nginx
Created /etc/nginx/php.mvc.conf and /etc/nginx/php.conf files for PHP sites
To use them "include" them in your /etc/nginx/sites-enabled/[site] config

The nginx part has a fault somewhere: Reloading nginx configuration: [emerg]: open() "/etc/nginx/fastcgi_php" failed (2: No such file or directory) in /etc/nginx/sites-enabled/pacura.ru.conf:4

The point is that in your script you mention a fastcgi_php which I can't find anywhere... but then you do reference it in your nginx vhost files

What command is missing here? I checked your script, line 512 but do not understand what script s missing: root@euve23694:~# bash setup-debian.sh domain pacura.ru
Created pacura (NGY4MzA1N2UxO) with all permissions on pacura_ru
setup-debian.sh: line 512: name: command not found

Your script seems to install wordpress by extracting the latest.zip into the vhosts root but the zip file contains wordpress inside a wordpress folder so the further configuration breaks. Please change it so it unzips without the folder straight into the root: cp: cannot stat `/var/www/pacura.ru/wp-config-sample.php': No such file or directory
sed: can't read /var/www/pacura.ru/wp-config.php: No such file or directory

After trying to fix it partially and getting it to run, I can access the default vhost but none of my test-sites that should use wordpress since it offers me the .php files for download, so it seems nginx isn't processing them but offering them for download. what could be wrong? one test site is http://klub-kamikaze.com give it a try.

@ovizii
Copy link
Author

ovizii commented Jun 8, 2011

made some progress:

instead of fastcgi_php it must be php.conf - apparently... if I change that in my test vhost, it kinda works. if I don't specify a filename it tries and downloads index.php if I specify the filename it work and display it !?

@ovizii ovizii closed this as completed Jun 8, 2011
@ovizii ovizii reopened this Jun 8, 2011
@xeoncross
Copy link

What flavor and version of linux are you running? I posted more explanations of the nginx php configs here. The wordpress install code isn't mine (I don't use wordpress) so this is the correct place to post bugs on it.

Apparently your install of nginx doesn't have the /etc/nginx/fastcgi_php file. Did you install dotdeb? If not (and you are using an older nginx from debian) then you might have to use /etc/nginx/fastcgi_params instead.

@ovizii
Copy link
Author

ovizii commented Jun 8, 2011

Hey thanks man,

Using a brand new VPS that came with Debian 5.0
I updated the source to point to Debian Squeeze (6.0) then ran your
script,one by one i.e. with dotdeb, then upgraded with apt-get dist-upgrade

Damn! I just realized dotdeb is inside here: /etc/apt/sources.list while the
Squeeze sources are in here: /etc/apt/sources.list.d/debian.list - not sure
if that is a problem?
I am going to copy the dotbed sources into the right place and update and
check again :-)

Before reading your answer I had already tried include
/etc/nginx/php.conf; and it kinda works now, I say kinda because
pages/posts/permalinks all works, except if I access a domain without a file
name it downloads the index.php
Try it here: http://klub-kamikaze.com/2011/hello-world/ works but
http://klub-kamikaze.com/ http://klub-kamikaze.com/2011/hello-world/
downloads
!`?

Ovidiu

The information in this email and attachments hereto may contain legally
privileged, proprietary or confidential information that is intended for a
particular recipient. If you are not the intended recipient(s), or the
employee or agent responsible for delivery of this message to the intended
recipient(s), you are hereby notified that any disclosure, copying,
distribution, retention or use of the contents of this e-mail information is
prohibited and may be unlawful. When addressed to customers or vendors, any
information contained in this e-mail is subject to the terms and conditions
in the governing contract, if applicable. If you have received this
communication in error, please immediately notify us by return e-mail,
permanently delete any electronic copies of this communication and destroy
any paper copies.

On Wed, Jun 8, 2011 at 21:17, Xeoncross <
[email protected]>wrote:

What flavor and version of linux are you running? I posted more
explanations of the nginx php configs here.
The wordpress install code isn't mine (I don't use wordpress) so this is the
correct place to post bugs on it.

Apparently your install of nginx doesn't have the /etc/nginx/fastcgi_php
file. Did you install dotdeb? If not (and you are using an older nginx from
debian) then you might have to use /etc/nginx/fastcgi_params instead.

Reply to this email directly or view it on GitHub:
#1 (comment)

@xeoncross
Copy link

This script assumes Debian 6 is installed. dotdeb is setup to work with squeeze not lenny so you would have to change the dotdeb lines in sources to fix this - actually, I am not even sure dotdeb supports nginx in lenny.

Debian 5 also needs backports to use PHP 5.3 which is another pain.

@ovizii
Copy link
Author

ovizii commented Jun 8, 2011

you must have misread my answer, so I'll explain again:

  • system is Lenny
  • update sources to point to Squeeze
  • update, then dist-upgrade
  • bash setup-debian.sh dotdeb
  • update, dist-upgrade again, reboot
  • bash setup-debian.sh system
  • bash setup-debian.sh optimize
  • bash setup-debian.sh mysql
  • bash setup-debian.sh nginx
  • bash setup-debian.sh php
  • bash setup-debian.sh domain mytestdomain.tld
  • bash setup-debian.sh wordpress mytestdomain.tld

you can check the php_info here: http://klub-kamikaze.com/info.php

@xeoncross
Copy link

The index seems to be loading fine for me (http://klub-kamikaze.com/). Just in case you didn't know, you have to restart nginx after you alter a /etc/nginx/sites-eabled/site config file.

@ovizii
Copy link
Author

ovizii commented Jun 8, 2011

jepp, I reloaded nginx after every restart and if I click this link: http://klub-kamikaze.com/ it downloads index.php to my PC - does it actually render in your browser?

@ovizii
Copy link
Author

ovizii commented Jun 8, 2011

ok, that is weird. it worked on my PC with a different browser :-(
nevermind, now what about that missing fastcgi_php file?

@xeoncross
Copy link

the index.php page was probably cached in your browser from the before when it was failing.

Can you print the output of ls -al /etc/nginx/? There should be a file there called "fastcgi_params" or something. I'm showing you have nginx/1.0.2 installed so it should be there.

@ovizii
Copy link
Author

ovizii commented Jun 8, 2011

fastcgi_params is there.
still your script gave the error:

Reloading nginx configuration: [emerg]: open() "/etc/nginx/fastcgi_php" failed (2: No such file or directory) in /etc/nginx/sites-enabled/pacura.ru.conf:4

The point is that in your script you mention a fastcgi_php which I can't find anywhere... but then you do reference it in your nginx vhost files

shall I replace mentions of fastcgi_php by fastcgi_params?

root@euve23694:~# ls -al /etc/nginx/
total 60
drwxr-xr-x 5 root root 4096 Jun 8 13:34 .
drwxr-xr-x 55 root root 4096 Jun 8 15:17 ..
drwxr-xr-x 2 root root 4096 Jun 8 13:00 conf.d
-rw-r--r-- 1 root root 867 Mar 23 04:20 fastcgi_params
-rw-r--r-- 1 root root 2258 Dec 2 2010 koi-utf
-rw-r--r-- 1 root root 1805 Dec 2 2010 koi-win
-rw-r--r-- 1 root root 2059 Feb 22 07:49 mime.types
-rw-r--r-- 1 root root 1340 Dec 2 2010 nginx.conf
-rw-r--r-- 1 root root 310 Jun 8 18:09 php.conf
-rw-r--r-- 1 root root 394 Jun 8 13:00 php.mvc.conf
-rw-r--r-- 1 root root 465 Dec 2 2010 scgi_params
drwxr-xr-x 2 root root 4096 Jun 8 13:00 sites-available
drwxr-xr-x 2 root root 4096 Jun 8 17:39 sites-enabled
-rw-r--r-- 1 root root 497 Dec 2 2010 uwsgi_params
-rw-r--r-- 1 root root 3071 Dec 2 2010 win-utf

@xeoncross
Copy link

Thanks for pointing it out, the solution is to update the install_wordpress() function to use fastcgi_params not fastcgi_php`. I didn't write that code so that is why I never caught that. I'll update my copy later on with the change and try to get LEA to fix his also.

If you look in the fastcgi_params file you will see it contains all the env variables PHP needs to run properly which would explain the bad behavior. I would replace the site config created by install_wordpress()...

server {
    server_name $1;
    root /var/www/$1;
    include /etc/nginx/fastcgi_php;
    location / {
        index index.php;
        if (!-e \$request_filename) {
            rewrite ^(.*)$  /index.php last;
        }
    }
}

with the one below:

server {
    listen 80;
    server_name example.com;
    root /var/www/example.com/;
    include /etc/nginx/php.conf;
}

@ovizii
Copy link
Author

ovizii commented Jun 8, 2011

hm, my vhost conf looks like this now:

server { server_name klub-kamikaze.com; root /var/www/klub-kamikaze.com; include /etc/nginx/php.conf; include /etc/nginx/fastcgi_params; }

notice I also included the fastcgi_params or isn't that necessary?
Also the listen 80 is implicit as far as I remember you only need it if it differs from 80

thanks for all the help here :-) this works awesome. I did some ab tests from another server and results look good. btw. if results are not as fast as expected, and there is enough memory and processor-wise there is still room for improvement, shall I check if mysql is becoming the bottleneck or are there any other things to check first with the nginx/fastcgi config?

@xeoncross
Copy link

Remove the extra include /etc/nginx/fastcgi_params; line since that is already in the include /etc/nginx/php.conf; file and only needed if serving PHP (waste for images/JS/CSS).

You can also remove the listen if you want. I leave it there because it doesn't hurt anything and explains more details.

I would look at installing wordpress caches first for the biggest boost. Then try tunning MySQL by giving it more memory. There is a script out there for this: https://github.com/rackerhacker/MySQLTuner-perl that will tell you what MySQL settings to change.

I would also look into setting up HTTP rate-limiting on nginx so that you will never be DoS's by a single IP (can't stop multiple IP's though).

@ovizii
Copy link
Author

ovizii commented Jun 8, 2011

thx. let me play with this for now and then think about tuning.

Btw. eagerly waiting for a postfix extension to this script :-)

and you can misuse me as beta tester, I just got a VPS for 4 days for testing. so I can test anything you throw at me...

@ovizii
Copy link
Author

ovizii commented Jun 9, 2011

kinda weird, after implementing what you suggested here: #1 (comment) wordpress links like: http://klub-kamikaze.com/wp-admin/ don't work anymore. the browser jsut stays on the same page...

if I put this back:

location / { index index.php; if (!-e \$request_filename) { rewrite ^(.*)$ /index.php last; } }

and visit http://klub-kamikaze.com/wp-admin/ again, it tells me that the page couldn't be found.

would appreciate any help to get wordpress running properly.

@ovizii
Copy link
Author

ovizii commented Jun 10, 2011

jsut wanted to mention that http://klub-kamikaze.com/wp-admin/index.php works so its about those links without a filename !?

@ovizii
Copy link
Author

ovizii commented Jun 15, 2011

no idea?

@xeoncross
Copy link

Sorry, I've been a little busy with family events recently.

Anyway, the folder "wp-admin" does exist which is why that rewrite fails to run unless you add a index.php at which point it fails again - but now you have a valid php file to pass to the Fastcgi process.

location / {
index index.php;
if (!-e \$request_filename) {
    rewrite ^(.*)$ /index.php last;
}
}

You probably just need to add the fastcgi index param to get it working:

 # unless the request is for a valid file, send to bootstrap
if (!-e $request_filename)
{
    rewrite ^(.+)$ /index.php?q=$1 last;
}

# use fastcgi for all php files
location ~ \.php$
{
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

@ovizii
Copy link
Author

ovizii commented Jun 15, 2011

thanks but I'm out of this game for a little while: I was testing on a trial VPS (free for 4 days) to see if it can do what I need it to do and with this script it looks like it can ;-)

will be back as soon as I get the real VPS I'm gonna use.

@ovizii
Copy link
Author

ovizii commented Jun 28, 2011

Playing with another test machine, still cannot reach mydomain/wp-admin/ my nginx vhost looks like:

`server {
server_name _ knightsenglish.com;
root /var/www/knightsenglish.com;
include /etc/nginx/php.conf;

unless the request is for a valid file, send to bootstrap

if (!-e $request_filename)
{
rewrite ^(.+)$ /index.php?q=$1 last;
}

use fastcgi for all php files

location ~ .php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}`

sorry I don't know how to format this as code :-(

@ovizii ovizii closed this as completed Jun 28, 2011
@ovizii ovizii reopened this Jun 28, 2011
@ovizii
Copy link
Author

ovizii commented Jun 28, 2011

solved:

replacing
if (!-e $request_filename) { rewrite ^(.+)$ /index.php?q=$1 last; }
by:
location / { try_files $uri $uri/ /index.php; }

peterdorsi referenced this issue in peterdorsi/lowendscript May 15, 2013
peterdorsi referenced this issue in peterdorsi/lowendscript May 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants