Table des matières
debug note-- nginx php-fpm : Error:The page you are looking for is temporarily unavailable.,note--nginx
About Lemp
Setup
Step One—Update Apt-Get
Step Two—Install MySQL
Step Three—Install nginx
Step Four—Install PHP
Step Five—Configure php
Step Six—Configure nginx
Step Seven—Create a php Info Page
我的freebsd系统下Nginx PHP提示出现The page you are looking for is temporarily unavailable错误?
nginx php fpm 怎显示错误日志
Maison développement back-end tutoriel php debug note-- nginx php-fpm : Error:The page you are looking for is temporarily unavailable.,note--nginx_PHP教程

debug note-- nginx php-fpm : Error:The page you are looking for is temporarily unavailable.,note--nginx_PHP教程

Jul 13, 2016 am 10:23 AM
nginx

debug note-- nginx php-fpm : Error:The page you are looking for is temporarily unavailable.,note--nginx

1.在ubuntu下安装配置nginx, mysql, php

安装步骤:

参考:https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04#

具体摘抄如下:

<h3 id="About-Lemp">About Lemp</h3>
<p>LEMP stack is a group of open source software to get web servers up and running. The acronym stands for Linux, nginx (pronounced Engine x), MySQL, and PHP. Since the server is already running Ubuntu, the linux part is taken care of. Here is how to install the rest.</p>
<h2 id="Setup">Setup</h2>
<p>The steps in this tutorial require the user to have root privileges. You can see how to set that up in the Initial Server Setup Tutorial in steps 3 and 4.</p>
<h2 id="Step-One-mdash-Update-Apt-Get">Step One&mdash;Update Apt-Get</h2>
<p>Throughout this tutorial we will be using apt-get as an installer for all the server programs. On May 8th, 2012, a serious php vulnerability was discovered, and it is important that we download all of the latest patched software to protect the virtual private server.</p>
<p>Let's do a thorough update.</p>
<pre class="code">sudo apt-get update
Copier après la connexion

Step Two—Install MySQL

MySQL is a powerful database management system used for organizing and retrieving data

To install MySQL, open terminal and type in these commands:

sudo apt-get install mysql-server php5-mysql
Copier après la connexion

During the installation, MySQL will ask you to set a root password. If you miss the chance to set the password while the program is installing, it is very easy to set the password later from within the MySQL shell.

Once you have installed MySQL, we should activate it with this command:

sudo mysql_install_db
Copier après la connexion

Finish up by running the MySQL set up script:

sudo /usr/bin/mysql_secure_installation
Copier après la connexion

The prompt will ask you for your current root password.

Type it in.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...
Copier après la connexion

Then the prompt will ask you if you want to change the root password. Go ahead and choose N and move on to the next steps.

It’s easiest just to say Yes to all the options. At the end, MySQL will reload and implement the new changes.

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y                                            
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...
Copier après la connexion

Once you're done with that you can finish up by installing PHP.

Step Three—Install nginx

Once MySQL is all set up, we can move on to installing nginx on the VPS.

sudo apt-get install nginx
Copier après la connexion

nginx does not start on its own. To get nginx running, type:

sudo service nginx start
Copier après la connexion

You can confirm that nginx has installed an your web server by directing your browser to your IP address.

You can run the following command to reveal your VPS's IP address.

ifconfig eth0 | grep inet | awk '{ print $2 }'
Copier après la connexion

Step Four—Install PHP

To install PHP-FPM, open terminal and type in these commands. We will configure the details of nginx and php details in the next step:

sudo apt-get install php5-fpm
Copier après la connexion

Step Five—Configure php

We need to make one small change in the php configuration.Open up php.ini:

 sudo nano /etc/php5/fpm/php.ini
Copier après la connexion

Find the line, cgi.fix_pathinfo=1, and change the 1 to 0.

cgi.fix_pathinfo=0
Copier après la connexion

If this number is kept as 1, the php interpreter will do its best to process the file that is as near to the requested file as possible. This is a possible security risk. If this number is set to 0, conversely, the interpreter will only process the exact file path—a much safer alternative. Save and Exit. We need to make another small change in the php5-fpm configuration.Open up www.conf:

 sudo nano /etc/php5/fpm/pool.d/www.conf
Copier après la connexion

Find the line, listen = 127.0.0.1:9000, and change the 127.0.0.1:9000 to /var/run/php5-fpm.sock.

listen = /var/run/php5-fpm.sock
Copier après la connexion

Save and Exit.

Restart php-fpm:

sudo service php5-fpm restart
Copier après la connexion

Step Six—Configure nginx

Open up the default virtual host file.

sudo nano /etc/nginx/sites-available/default
Copier après la connexion

The configuration should include the changes below (the details of the changes are under the config information):

UPDATE: Newer Ubuntu versions create a directory called 'html' instead of 'www' by default. If /usr/share/nginx/www does not exist, it's probably called html. Make sure you update your configuration appropriately.

 [...]
server {
        listen   80;
     

        root /usr/share/nginx/www;
        index index.php index.html index.htm;

        server_name example.com;

        location / {
                try_files $uri $uri/ /index.html;
        }

        error_page 404 /404.html;

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
              root /usr/share/nginx/www;
        }

        # pass the PHP scripts to FastCGI server listening on the php-fpm socket
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
                
        }

}
[...]
Copier après la connexion

Here are the details of the changes:

  • Add index.php to the index line.
  • Change the server_name from local host to your domain name or IP address (replace the example.com in the configuration)
  • Change the correct lines in “location ~ \.php$ {“ section

Save and Exit

Step Seven—Create a php Info Page

We can quickly see all of the details of the new php configuration.

To set this up, first create a new file:

sudo nano /usr/share/nginx/www/info.php
Copier après la connexion

Add in the following line:

<?php
phpinfo();
?>
Copier après la connexion

Then Save and Exit.

Restart nginx

sudo service nginx restart
Copier après la connexion

You can see the nginx and php-fpm configuration details by visiting http://youripaddress/info.php

Your LEMP stack is now set up and configured on your virtual private server.

2. 按照上述文章介绍的安装步骤安装之后,通过浏览器访问php文件得到502页面:The page you are looking for is temporarily unavailable.

检查nginx的error.log文件: 发现错误:connect to php5-fpm.sock failed (Permission denied),

检查php5-fpm.sock的权限得到other的权限为:---

解决方法:

参考:http://stackoverflow.com/questions/23443398/nginx-error-connect-to-php5-fpm-sock-failed-13-permission-denied

具体摘抄如下:

<p><strong>     Note</strong>: if your webserver runs as as user other than www-data, you will need to update the <code>www.conf</code> file accordingly</p>
Copier après la connexion

我的freebsd系统下Nginx PHP提示出现The page you are looking for is temporarily unavailable错误?

1.先检查PHP FastCGI进程数是否够用:
netstat -anpo|grep “php-cgi”|wc -l
如果输出为0的话,则表示FastCGI 进程数够大,

2.此时则修改scgi_params文件,找到:

scgi_param SCGI 1;

把它改为:

scgi_param SCGI 5;

3.PHP程序如果的执行时间超过了Nginx的等待时间,就可适当地增加nginx.conf配置文件中FastCGI的timeout时间,例如:
http
{
……
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k
fastcgi_buffers 4 64k
……
}

4.重启FastCGI

先杀掉进程:# pkill -9 php-cgi
然后重启:# /usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/local/bin/php-cgi

5.重启Nginx

先杀掉进程:# killall -9 nginx
然后重启:# /usr/local/sbin/nginx

其它可能情况:

1)访问任意PHP文件,出现

The page you are looking for is temporarily unavailable.
Please try again later.

2)访问html页面,正常

原因:
nginx不能正常通过FastCGI结果访问PHP

1)如果是以tcp socket形式,可能是进程用户权限设置得不对

spawn-fcgi -a 127.0.0.1 -p 9000 -C 2 -u www-data -g www-data -f /usr/bin/php-cgi

可以改为 www-data 或者 nobody, 重启php-cgi进程

2)如果是unix socket,可能 socket文件权限没有写入能力

srwxrwxr-x 1 gavin gavin 0 11-12 10:18 php-fcgi.sock

为其他用户添加写入能力

chmod o+w php-fcgi.sock
参考资料:hi.baidu.com/...7.html...余下全文>>
 

nginx php fpm 怎显示错误日志

要想让php-fpm显示错误日志,首先需要配置php-fpm。
在php-fpm的配置文件中(一般位于php安装目录下的etc/php-fpm.conf)配置php错误日志的文件路径。
; Error log file; If it's set to "syslog", log is sent to syslogd instead of being written; in a local file.; Note: the default prefix is /home/wangwei/php/var; Default Value: log/php-fpm.log;error_log = log/php-fpm.log如上是我的php-fpm.conf文件中配置错误日志的地方。把error_log = log/php-fpm.log之前的;去掉,然后修改为:
; Error log file; If it's set to "syslog", log is sent to syslogd instead of being written; in a local file.; Note: the default prefix is /home/wangwei/php/var; Default Value: log/php-fpm.logerror_log = /home/work/log/php-fpm.log.wf修改之后,保存配置,然后重启php-fpm就可以啦。
注意如果用相对路径的话,的路径的前缀是基于php安装目录的var目录的。

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/834761.htmlTechArticledebug note-- nginx php-fpm : Error:The page you are looking for is temporarily unavailable.,note--nginx 1.在ubuntu下安装配置nginx, mysql, php 安装步骤: 参考:https...
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn

Outils d'IA chauds

Undresser.AI Undress

Undresser.AI Undress

Application basée sur l'IA pour créer des photos de nu réalistes

AI Clothes Remover

AI Clothes Remover

Outil d'IA en ligne pour supprimer les vêtements des photos.

Undress AI Tool

Undress AI Tool

Images de déshabillage gratuites

Clothoff.io

Clothoff.io

Dissolvant de vêtements AI

AI Hentai Generator

AI Hentai Generator

Générez AI Hentai gratuitement.

Article chaud

R.E.P.O. Crystals d'énergie expliqués et ce qu'ils font (cristal jaune)
1 Il y a quelques mois By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Meilleurs paramètres graphiques
1 Il y a quelques mois By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Vous avez un jeu croisé?
1 Il y a quelques mois By 尊渡假赌尊渡假赌尊渡假赌

Outils chauds

Bloc-notes++7.3.1

Bloc-notes++7.3.1

Éditeur de code facile à utiliser et gratuit

SublimeText3 version chinoise

SublimeText3 version chinoise

Version chinoise, très simple à utiliser

Envoyer Studio 13.0.1

Envoyer Studio 13.0.1

Puissant environnement de développement intégré PHP

Dreamweaver CS6

Dreamweaver CS6

Outils de développement Web visuel

SublimeText3 version Mac

SublimeText3 version Mac

Logiciel d'édition de code au niveau de Dieu (SublimeText3)

Comment vérifier si Nginx est démarré Comment vérifier si Nginx est démarré Apr 14, 2025 pm 01:03 PM

Comment confirmer si Nginx est démarré: 1. Utilisez la ligne de commande: SystemCTl Status Nginx (Linux / Unix), netStat -ano | Findstr 80 (Windows); 2. Vérifiez si le port 80 est ouvert; 3. Vérifiez le message de démarrage NGINX dans le journal système; 4. Utilisez des outils tiers, tels que Nagios, Zabbix et Icinga.

Comment configurer le nom de domaine du serveur cloud dans nginx Comment configurer le nom de domaine du serveur cloud dans nginx Apr 14, 2025 pm 12:18 PM

Comment configurer un nom de domaine NGINX sur un serveur cloud: Créez un enregistrement A pointant vers l'adresse IP publique du serveur cloud. Ajoutez des blocs d'hôtes virtuels dans le fichier de configuration Nginx, en spécifiant le port d'écoute, le nom de domaine et le répertoire racine du site Web. Redémarrez Nginx pour appliquer les modifications. Accéder à la configuration du test de nom de domaine. Autres notes: Installez le certificat SSL pour activer HTTPS, assurez-vous que le pare-feu autorise le trafic Port 80 et attendez que la résolution DNS prenne effet.

Comment démarrer le serveur Nginx Comment démarrer le serveur Nginx Apr 14, 2025 pm 12:27 PM

Le démarrage d'un serveur Nginx nécessite différentes étapes en fonction des différents systèmes d'exploitation: Système Linux / Unix: Installez le package NGINX (par exemple, en utilisant Apt-Get ou Yum). Utilisez SystemCTL pour démarrer un service NGINX (par exemple, sudo systemctl start nginx). Système Windows: téléchargez et installez les fichiers binaires Windows. Démarrer Nginx à l'aide de l'exécutable Nginx.exe (par exemple, nginx.exe -c conf \ nginx.conf). Peu importe le système d'exploitation que vous utilisez, vous pouvez accéder au serveur IP

Comment démarrer Nginx dans Linux Comment démarrer Nginx dans Linux Apr 14, 2025 pm 12:51 PM

Étapes pour démarrer Nginx dans Linux: Vérifiez si Nginx est installé. Utilisez SystemCTL Start Nginx pour démarrer le service NGINX. Utilisez SystemCTL Activer Nginx pour activer le démarrage automatique de Nginx au démarrage du système. Utilisez SystemCTL Status Nginx pour vérifier que le démarrage est réussi. Visitez http: // localhost dans un navigateur Web pour afficher la page de bienvenue par défaut.

Comment configurer Nginx dans Windows Comment configurer Nginx dans Windows Apr 14, 2025 pm 12:57 PM

Comment configurer Nginx dans Windows? Installez Nginx et créez une configuration d'hôte virtuelle. Modifiez le fichier de configuration principale et incluez la configuration de l'hôte virtuel. Démarrer ou recharger nginx. Testez la configuration et affichez le site Web. Activer sélectivement SSL et configurer les certificats SSL. Définissez sélectivement le pare-feu pour permettre le trafic Port 80 et 443.

Comment résoudre nginx403 Comment résoudre nginx403 Apr 14, 2025 am 10:33 AM

Comment corriger l'erreur interdite Nginx 403? Vérifier les autorisations de fichier ou de répertoire; 2. Vérifier le fichier .htaccess; 3. Vérifiez le fichier de configuration NGINX; 4. Redémarrer Nginx. D'autres causes possibles incluent les règles de pare-feu, les paramètres de Selinux ou les problèmes d'application.

Comment vérifier si Nginx est démarré? Comment vérifier si Nginx est démarré? Apr 14, 2025 pm 12:48 PM

Dans Linux, utilisez la commande suivante pour vérifier si Nginx est démarré: SystemCTL Status Nginx Juges Basé sur la sortie de la commande: si "Active: Active (Running)" s'affiche, Nginx est démarré. Si "Active: Inactive (Dead)" est affiché, Nginx est arrêté.

Comment résoudre le problème du domaine croisé nginx Comment résoudre le problème du domaine croisé nginx Apr 14, 2025 am 10:15 AM

Il existe deux façons de résoudre le problème du domaine transversal NGINX: modifiez les en-têtes de réponse transversale: ajoutez des directives pour autoriser les demandes de domaine croisé, spécifier des méthodes et des en-têtes autorisés et définir le temps du cache. Utilisez le module CORS: Activez les modules et configurez les règles CORS pour permettre des demandes, des méthodes, des en-têtes et du temps de cache.

See all articles