Ubuntu下安装PHP+Nginx
?系统环境:Ubuntu12.04 desktop
?
?
1、sudo apt-get install php5-cgi
???(因为nginx只支持fast-cgi,所以要安装php5-cgi)
?提示安装以下资源
?
将会安装下列额外的软件包: libapache2-mod-php5 php5-cli php5-common php5-gd php5-mysql 建议安装的软件包: php-pear php5-suhosin 下列【新】软件包将被安装: php5-cgi 下列软件包将被升级: libapache2-mod-php5 php5-cli php5-common php5-gd php5-mysql
?
2、sudo apt-get install nginx
??
3、vim /etc/nginx/site-available/default
?
server { 21 #listen 80; ## listen for ipv4; this line is default and implied 22 #listen [::]:80 default ipv6only=on; ## listen for ipv6 23 24 root /usr/share/nginx/www; 25 index index.html index.htm; 26 27 # Make site accessible from http://localhost/ 28 server_name localhost; 29 30 location / { 31 # First attempt to serve request as file, then 32 # as directory, then fall back to index.html 33 try_files $uri $uri/ /index.html; 34 # Uncomment to enable naxsi on this location 35 # include /etc/nginx/naxsi.rules 36 } 37 38 location /doc/ { 39 alias /usr/share/doc/; 40 autoindex on; 41 allow 127.0.0.1; 42 deny all; 43 } 44 45 # Only for nginx-naxsi : process denied requests 46 #location /RequestDenied { 47 # For example, return an error code 48 #return 418; 49 #} 50 51 #error_page 404 /404.html; 52 53 # redirect server error pages to the static page /50x.html 54 # 55 #error_page 500 502 503 504 /50x.html; 56 #location = /50x.html { 57 # root /usr/share/nginx/www; 58 #} 59 60 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 61 # 62 location ~ \.php$ { 63 # fastcgi_split_path_info ^(.+\.php)(/.+)$; 64 # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini 65 # 66 # # With php5-cgi alone: 67 fastcgi_pass 127.0.0.1:9000; 68 # # With php5-fpm: 69 # fastcgi_pass unix:/var/run/php5-fpm.sock; 70 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 71 fastcgi_index index.php; }
?
?sudo /etc/init.d/nginx restart ?(注意这里以sduo的方式重启,否则因为权限文件报错)
?
4、vim index.php ? (在 ?/usr/share/nginx/www 下面创建文件index.php测试)
?
?
<?php echo "hello world"; ?>?
结果出现如下错误:connect() failed (111: Connection refused) while connecting to upstream
?
那是因为没有安装 ?php5-fmp
?
5、sudo apt-get install php5-fmp
?
重启nginx服务后就可以看到页面结果了。
?
?
补充:安装phpmyadmin的时候报错:?phpmyadmin缺少mysqli扩展
?
检查/etc/php5/apache2/php.ini文件下extension=php_mysqli.dll是否启用
?
?
?
?
?
?
?

phpsessionscanstorestrings, 숫자, 배열 및 객체 1.Strings : TextDatalikeUsernames.2.numbers : integorfloatsforcounters.3.arrays : listslikeshoppingcarts.4.objects : complexStructuresThatareserialized.

세션 재생은 세션 고정 공격의 경우 사용자가 민감한 작업을 수행 할 때 새 세션 ID를 생성하고 이전 ID를 무효화하는 것을 말합니다. 구현 단계에는 다음이 포함됩니다. 1. 민감한 작업 감지, 2. 새 세션 ID 생성, 3. 오래된 세션 ID 파괴, 4. 사용자 측 세션 정보 업데이트.

PHP 세션은 응용 프로그램 성능에 큰 영향을 미칩니다. 최적화 방법은 다음과 같습니다. 1. 데이터베이스를 사용하여 세션 데이터를 저장하여 응답 속도를 향상시킵니다. 2. 세션 데이터 사용을 줄이고 필요한 정보 만 저장하십시오. 3. 비 차단 세션 프로세서를 사용하여 동시성 기능을 향상시킵니다. 4. 사용자 경험과 서버 부담의 균형을 맞추기 위해 세션 만료 시간을 조정하십시오. 5. 영구 세션을 사용하여 데이터 읽기 및 쓰기 시간의 수를 줄입니다.

phpsessionsareser-side, whilecookiesareclient-side.1) sessions stessoredataontheserver, andhandlargerdata.2) cookiesstoredataonthecure, andlimitedinsize.usesessionsforsensitivestataondcookiesfornon-sensistive, client-sensation.

phpidifiesauser의 sssessionusessessioncookiesandssessionids.1) whensession_start () iscalled, phpgeneratesauniquessessionStoredInacookienamedPhpsSessIdonSeuser 'sbrowser.2) thisidallowsphptoretrievessessionDataTromServer.

PHP 세션의 보안은 다음 측정을 통해 달성 할 수 있습니다. 1. Session_REGENEREAT_ID ()를 사용하여 사용자가 로그인하거나 중요한 작업 일 때 세션 ID를 재생합니다. 2. HTTPS 프로토콜을 통해 전송 세션 ID를 암호화합니다. 3. 세션 _save_path ()를 사용하여 세션 데이터를 저장하고 권한을 올바르게 설정할 보안 디렉토리를 지정하십시오.

phpsessionfilesarestoredInTheRectorySpecifiedBysession.save_path, 일반적으로/tmponunix-likesystemsorc : \ windows \ temponwindows.tocustomizethis : 1) austession_save_path () toSetacustomDirectory, verlyTeCustory-swritation;


핫 AI 도구

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

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

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

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

VSCode Windows 64비트 다운로드
Microsoft에서 출시한 강력한 무료 IDE 편집기

드림위버 CS6
시각적 웹 개발 도구

Dreamweaver Mac版
시각적 웹 개발 도구

SublimeText3 Linux 새 버전
SublimeText3 Linux 최신 버전
