Let's talk about the problems encountered when we first set up nginx + php + mysql:
Nginx + php (5.5.10) + mysql
The source code has been written locally and debugged successfully (the default configuration of XAMPP is used in the local environment). when the code is uploaded to linux, the following problems occur:
[1] When writing logs:
PHP message: PHP Warning: fopen (log/log. log.141019): failed to open stream: Permission denied
This indicates that you have no access permission.
Solution: linux has some restrictions on php access user permissions. by default, it should be nobody access. Therefore, you only need to add permissions to the corresponding directory of nobody,
Operation: chown nobody: nobody log
[2] when accessing mysql:
PHP message: PHP Warning: mysql_connect (): No such file or directory
By default, php accesses mysql. sock at/var/mysql. sock, while my mysql handle is at/var/lib/mysql/mysq. sock,
Therefore, you only need to give a link: ln-s/var/lib/mysql/mysq. sock/var/mysql. sock
In addition, during XAMPP debugging, all the errors are reported on the page, which is very insecure and is thinking about how to handle them. nginx intercepts the error information, written in your own log file, this is good. (Can I configure it? To be studied later)
First, let's take a look at the solution. later, we will have time to get it done. now we are busy launching this service.