首页 \ 问答 \ nginx怎么配置php环境呢?

nginx怎么配置php环境呢?

服务器上有java环境,用的nginx做跳转,但是现在需要安装一个bbs 用的是开源的dz 现在需要怎么配置nginx呢?搞了半天都没弄出来,求高手啊~
更新时间:2021-09-21 19:09

最满意答案

 是指nginx配置有问题吗?还是其他方面
安装系统依赖包


           
yum install make apr* autoconf automake curl curl-devel gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch
  安装libmcrypt
tar -zxvf libmcrypt-2.5.7.tar.gz cd libmcrypt-2.5.7 ./configure --prefix=/usr/local/libmcrypt make make install  

安装pcre

tar -zxvf pcre-8.30.tar.gz cd pcre-8.30 ./configure --prefix=/usr/local/pcre make make install  
安装cmake
tar -zxvf cmake-2.8.7.tar.gz cd cmake-2.8.7 ./configure make make install
  安装nginx
wget http://www.openssl.org/source/openssl-1.0.1.tar.gz tar -zxvf openssl-1.0.1.tar.gz groupadd www useradd -g www www -s /bin/false tar -zxvf nginx-1.2.3.tar.gz vi nginx-1.2.3/auto/cc/gcc # debug #CFLAGS="$CFLAGS -g" cd nginx-1.2.3 ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-openssl=/data/openssl-1.0.1 --with-pcre=/data/pcre-8.30 --with-md5=/usr/lib --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-cc-opt='-O3' make make install clean chown www:www /usr/local/nginx/html/ -R
配置nginx启动服务 vi /etc/rc.d/init.d/nginx #!/bin/bash # nginx Startup script for the Nginx HTTP Server # it is v.0.0.2 version. # chkconfig: - 85 15 # description: Nginx is a high-performance web and proxy server. # It has a lot of features, but it's not for everyone. # processname: nginx # pidfile: /var/run/nginx.pid # config: /usr/local/nginx/conf/nginx.conf nginxd=/usr/local/nginx/sbin/nginx nginx_config=/usr/local/nginx/conf/nginx.conf nginx_pid=/usr/local/nginx/logs/nginx.pid RETVAL=0 prog="nginx" # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -x $nginxd ] || exit 0 # Start nginx daemons functions. start() { if [ -e $nginx_pid ];then echo "nginx already running...." exit 1 fi echo -n $"Starting $prog: " daemon $nginxd -c ${nginx_config} RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx return $RETVAL } # Stop nginx daemons functions. stop() { echo -n $"Stopping $prog: " killproc $nginxd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid } reload() { echo -n $"Reloading $prog: " #kill -HUP `cat ${nginx_pid}` killproc $nginxd -HUP RETVAL=$? echo } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) stop start ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $prog {start|stop|restart|reload|status|help}" exit 1 esac exit $RETVAL      
chmod 755 /etc/rc.d/init.d/nginx chkconfig --add nginx chkconfig --level 345 nginx on /usr/local/nginx/sbin/nginx ps -ef|grep nginx root     16983     1  0 11:08 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx www      16984 16983  0 11:08 ?        00:00:00 nginx: worker process      root     16986  2599  0 11:08 pts/0    00:00:00 grep nginx netstat -nat|grep 80 tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN
nginx配置文件主要改
vi /usr/local/nginx/conf/nginx.conf user  www www; location / {             root   html;             index index.php;         } location ~ \.php$ {             root           html;             fastcgi_pass   127.0.0.1:9000;             fastcgi_index  index.php;             #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;             include        fastcgi_params;         }  

其他回答

需要的话 联系我 发你邮箱

相关问答

更多
  • 使用nginx+php集成包phpfind或phpstudy即可一键安装好环境。还支持php版本一键切换,带控制面板的,纯中文绿色解压即可,完全符合国人使用习惯,你试试吧
  • PHP开发环境配置(Windows版) Apache+MySQL+PHP+phpMyAdmin 我的系统:Windows XP Author:usnay Time:2009-7-7 Step1:下载以下文件 (1)php-5.2.0-Win32.zip pecl-5.2.0-Win32.zip 下载地址:[url]http://www.php.net/downloads.php[/url] (2)apache_2.2.3-win32-x86-no_ssl.msi 下载地址:[url]http://http ...
  • 你别在用户目录里直接运行,这样他会把当前目录看错是用户目录了 D:(先换到D盘) cd wnmp/nginx(切换到NGINX的根目录) nginx(执行nginx.exe) 话说windows下不是可以直接双击nginx.exe的么
  • 我昨天从网上看到,nginx 0day漏洞 上传图片可入侵百万台服务器,我想如果是自己用VM虚拟机练练手还好,要是做服务器,可得小心了.
  • 1,下载PHP   php下载版本比较多,其中,   vc9=vs2008编译,推荐使用IIS+php搭配模式,   vc6=vs6编译,推荐使用apache+php方式搭配,   Thread Safe,线程安全,执行时会进行线程(Thread)安全检查,以防止有新要求就启动新线程的CGI执行方式而耗尽系统资源。Non Thread Safe是非线程安全,在执行时不进行线程(Thread)安全检查。   Non Thread Safe,   再来看PHP的两种执行方式:ISAPI和FastCGI。   I ...
  • 我昨天从网上看到,nginx 0day漏洞 上传图片可入侵百万台 服务器,我想如果是自己用VM 虚拟机练练手还好,要是做服务器,可得小心了.
  • 是指nginx配置有问题吗?还是其他方面 安装系统依赖包 yum install make apr* autoconf automake curl curl-devel gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils- ...
  • 已经安装好了!
  • CGI的英文全称为Common Gateway Interface(公共网关接口),是Nginx和动态脚本程序的桥梁,Nginx通过FastCGI接口将动态请求发送给FastCGI,FastCGI中的Wrapper进程生成一个线程,将请求交给脚本解释程序执行,然后通过原来的socket将解释执行后的结果原路返回给Nginx,之后Nginx将结果交给客户端。 Nginx是通过套接字文件socket来将动态请求发送给wrapper,使用的是Tcp协议。wrapper通过CGI接口来接受请求。这样web服务器和解 ...
  • 可以的,具体步骤推荐给你一个连接,上面有完整步骤 网页链接

相关文章

更多

最新问答

更多
  • 如何重新加载下拉列表(How to reload dropdownlist)
  • RStudio:在脚本中保留特殊字符(RStudio: keeping special characters in a script)
  • Powershell的“GetLatest”不会在新的TFS工作区上下载文件(“GetLatest” with Powershell doesn't download files on new TFS workspace)
  • 我如何让JS识别一个由字符组成的数组?(How do I get JS to recognise an array insted of characters?)
  • EF从存储过程中急切加载(EF eager loading from stored procedure)
  • 将输出文件添加到Python扩展(Adding output file to Python extension)
  • 淮北职业技术学院电脑应用专业咋样?
  • 更改默认扩展面板箭头的箭头样式(Change arrow style for default expansion panel arrow)
  • 芜湖计算机(计算机)培训机构(培训班,学校)哪家好
  • 致命错误:使用clang-llvm ASTMatcher时未找到'stddef.h'文件(fatal error: 'stddef.h' file not found when using clang-llvm ASTMatcher)
  • 内容的.NET缓存(Contentful .NET caching)
  • 客户端没有发生WCF回调(WCF callback is not happening in client)
  • 使用friend在全局范围内调用类成员函数会产生27个错误(Calling a Class member function in Global Scope using friend Gives 27 ERRORS)
  • 如何绑定到WPF中的另一个控件属性(How to Bind to Another Control Property in WPF)
  • 南华大学电脑专业,就业好不好
  • 是否存在泄密文件的官方(或常见)文件扩展名或后缀?(Is there an official (or common) file extention or suffix for deflated files?)
  • 在SVM python中只训练一次(Training only once in SVM python)
  • 淘汰自定义绑定光滑js无法正常工作(knockout custom binding for slick js not working)
  • 似乎无法正确地抓住网站“福布斯”(Can't seem to scrape the website “Forbes” properly)
  • 无法使用boto.rds2从describe_instance方法检索有关db实例的信息(Not able to retrieve information about db instances from the describe_instance method using boto.rds2)
  • 转换为英国日期格式问题(Convert to british date format issue)
  • 在表中列出不同的元组(10种方法)(List distinct tuples in a table(SQL query)(10 ways))
  • OrientDB查询比较(OrientDB query compare)
  • 全局变量有什么不好?(What is so bad about global variables? [duplicate])
  • 为什么JavaMail Transport.send()是一个静态方法?(Why is JavaMail Transport.send() a static method?)
  • 获取最近3个Instagram图像张贴在一个地方(Get last 3 instagram images posted in a place)
  • 使用libnfc格式化/读/写NDEF Mifare 1K卡(Format/Read/Write NDEF Mifare 1K Card using libnfc)
  • 阻止谷歌索引特定图像(Block Google from indexing a particular image)
  • 消息模板接收让Dispatcher没有订阅频道(Message Template receive gives Dispatcher has no subscribers for channel)
  • OpenShift:使用自定义节点版本(OpenShift: Use custom node version)