목차
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 怎显示错误日志
php教程 php手册 debug note-- nginx php-fpm : Error:The page you are looking for is temporarily unavailable.,note--nginx

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

Jun 13, 2016 am 09:29 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
로그인 후 복사

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
로그인 후 복사

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
로그인 후 복사

Finish up by running the MySQL set up script:

sudo /usr/bin/mysql_secure_installation
로그인 후 복사

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...
로그인 후 복사

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...
로그인 후 복사

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
로그인 후 복사

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

sudo service nginx start
로그인 후 복사

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 }'
로그인 후 복사

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
로그인 후 복사

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
로그인 후 복사

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

cgi.fix_pathinfo=0
로그인 후 복사

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
로그인 후 복사

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
로그인 후 복사

Save and Exit.

Restart php-fpm:

sudo service php5-fpm restart
로그인 후 복사

Step Six—Configure nginx

Open up the default virtual host file.

sudo nano /etc/nginx/sites-available/default
로그인 후 복사

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;
                
        }

}
[...]
로그인 후 복사

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
로그인 후 복사

Add in the following line:

<?php
phpinfo();
?>
로그인 후 복사

Then Save and Exit.

Restart nginx

sudo service nginx restart
로그인 후 복사

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>
로그인 후 복사

我的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目录的。

 

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
3 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

Tomcat 서버에 대한 외부 네트워크 액세스를 허용하는 방법 Tomcat 서버에 대한 외부 네트워크 액세스를 허용하는 방법 Apr 21, 2024 am 07:22 AM

Tomcat 서버가 외부 네트워크에 액세스하도록 허용하려면 다음을 수행해야 합니다. 외부 연결을 허용하도록 Tomcat 구성 파일을 수정합니다. Tomcat 서버 포트에 대한 액세스를 허용하는 방화벽 규칙을 추가합니다. Tomcat 서버 공용 IP에 대한 도메인 이름을 가리키는 DNS 레코드를 만듭니다. 선택 사항: 역방향 프록시를 사용하여 보안 및 성능을 향상합니다. 선택 사항: 보안 강화를 위해 HTTPS를 설정합니다.

thinkphp를 실행하는 방법 thinkphp를 실행하는 방법 Apr 09, 2024 pm 05:39 PM

ThinkPHP Framework를 로컬에서 실행하는 단계: ThinkPHP Framework를 로컬 디렉터리에 다운로드하고 압축을 풉니다. ThinkPHP 루트 디렉터리를 가리키는 가상 호스트(선택 사항)를 만듭니다. 데이터베이스 연결 매개변수를 구성합니다. 웹 서버를 시작합니다. ThinkPHP 애플리케이션을 초기화합니다. ThinkPHP 애플리케이션 URL에 접속하여 실행하세요.

nginx에 오신 것을 환영합니다! 어떻게 해결하나요? nginx에 오신 것을 환영합니다! 어떻게 해결하나요? Apr 17, 2024 am 05:12 AM

"Welcome to nginx!" 오류를 해결하려면 가상 호스트 구성을 확인하고, 가상 호스트를 활성화하고, Nginx를 다시 로드하고, 가상 호스트 구성 파일을 찾을 수 없으면 기본 페이지를 만들고, Nginx를 다시 로드해야 합니다. 그러면 오류 메시지가 나타납니다. 사라지고 웹사이트는 정상적으로 표시됩니다.

도커 컨테이너 간 통신 방법 도커 컨테이너 간 통신 방법 Apr 07, 2024 pm 06:24 PM

Docker 환경에는 공유 네트워크, Docker Compose, 네트워크 프록시, 공유 볼륨 및 메시지 큐의 5가지 컨테이너 통신 방법이 있습니다. 격리 및 보안 요구 사항에 따라 Docker Compose를 활용하여 연결을 단순화하거나 네트워크 프록시를 사용하여 격리를 높이는 등 가장 적절한 통신 방법을 선택하세요.

HTML 파일에서 URL을 생성하는 방법 HTML 파일에서 URL을 생성하는 방법 Apr 21, 2024 pm 12:57 PM

HTML 파일을 URL로 변환하려면 다음 단계를 포함하는 웹 서버가 필요합니다. 웹 서버를 얻습니다. 웹 서버를 설정합니다. HTML 파일을 업로드하세요. 도메인 이름을 만듭니다. 요청을 라우팅합니다.

nodejs 프로젝트를 서버에 배포하는 방법 nodejs 프로젝트를 서버에 배포하는 방법 Apr 21, 2024 am 04:40 AM

Node.js 프로젝트의 서버 배포 단계: 배포 환경 준비: 서버 액세스 권한 획득, Node.js 설치, Git 저장소 설정. 애플리케이션 빌드: npm run build를 사용하여 배포 가능한 코드와 종속성을 생성합니다. Git 또는 파일 전송 프로토콜을 통해 서버에 코드를 업로드합니다. 종속성 설치: SSH를 서버에 연결하고 npm install을 사용하여 애플리케이션 종속성을 설치합니다. 애플리케이션 시작: node index.js와 같은 명령을 사용하여 애플리케이션을 시작하거나 pm2와 같은 프로세스 관리자를 사용합니다. 역방향 프록시 구성(선택 사항): Nginx 또는 Apache와 같은 역방향 프록시를 사용하여 트래픽을 애플리케이션으로 라우팅합니다.

Dockerfile에서 가장 일반적인 지침은 무엇입니까? Dockerfile에서 가장 일반적인 지침은 무엇입니까? Apr 07, 2024 pm 07:21 PM

Dockerfile에서 가장 일반적으로 사용되는 지침은 다음과 같습니다. FROM: 새 이미지 생성 또는 새 이미지 파생 RUN: 명령 실행(소프트웨어 설치, 시스템 구성) COPY: 로컬 파일을 이미지에 복사 ADD: COPY와 유사하며 자동으로 압축을 풀 수 있습니다. tar 아카이브 또는 URL 파일 얻기 CMD: 컨테이너가 시작될 때 명령 지정 EXPOSE: 컨테이너 수신 포트 선언(공개는 아님) ENV: 환경 변수 설정 VOLUME: 호스트 디렉터리 또는 익명 볼륨 마운트 WORKDIR: 작업 디렉터리 설정 컨테이너 ENTRYPOINT: 컨테이너가 시작될 때 실행할 항목을 지정합니다. 실행 파일(CMD와 유사하지만 덮어쓸 수 없음)

nodejs를 외부에서 접근할 수 있나요? nodejs를 외부에서 접근할 수 있나요? Apr 21, 2024 am 04:43 AM

예, Node.js는 외부에서 액세스할 수 있습니다. 다음 방법을 사용할 수 있습니다. Cloud Functions를 사용하여 함수를 배포하고 공개적으로 액세스할 수 있도록 합니다. Express 프레임워크를 사용하여 경로를 만들고 끝점을 정의합니다. Nginx를 사용하여 Node.js 애플리케이션에 대한 프록시 요청을 역방향으로 수행합니다. Docker 컨테이너를 사용하여 Node.js 애플리케이션을 실행하고 포트 매핑을 통해 노출합니다.

See all articles