CentOS7配置Ngnix+PHP
来源:互联网 发布:蒙泰怎样正确设置端口 编辑:程序博客网 时间:2024/05/16 19:12
首先安装nignx
yum install -y nginx
安装php和相关包
yum install php-fpm php-cli php-mysql php-gd php-ldap php-odbc php-pdo php-pecl-memcache php-pear php-mbstring php-xml php-xmlrpc php-mbstring php-snmp php-soap php-develpecl install apc
编辑php和php-fpm的配置文件
vim /etc/php.ini找到:;date.timezone =修改为:date.timezone = Aisa/Shanghai找到:disable_functions =修改为:disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
vim /etc/php-fpm.confpid = run/php-fpm.pid
vim /etc/php-fpm.d/*.conf
user = nginx #设置php-fpm运行账号为nginx
group = nginx #设置php-fpm运行组为nginx
编辑 nginx的配置文件
[root@node1 nginx]# cat nginx.conf# For more information on configuration, see:# * Official English Documentation: http://nginx.org/en/docs/# * Official Russian Documentation: http://nginx.org/ru/docs/**user nginx nginx;** 这里要做修改改成nginx的用户组和密码worker_processes auto;error_log /var/log/nginx/error.log;pid /run/nginx.pid;......[root@node1 nginx]# vim /etc/nginx/nginx.conf server { listen 80 default_server; listen [::]:80 default_server; server_name _; **root /usr/share/nginx/html;** 这个就是nginx服务器放置网页界面的路径 **index index.html index.php index.htm** # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { root /usr/share/nginx/html; index index.html index.htm index.php; } location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
server里面和 location 进行修改。
然后
[root@node1 nginx]# cd /usr/share/nginx/html[root@node1 html]# rm -rf *[root@node1 html]# vim index.php<?phpphpinfo();?>
然后启动php-fpm和nginx服务
service nginx start
service php-fpm restart
这样php和nginx 就能建立了
0 0
- CentOS7配置Ngnix+PHP
- linux+ngnix+php 安装配置
- php+ngnix windows下配置
- 在虚拟机上配置ngnix+php
- ngnix 配置
- ngnix配置
- Ngnix配置
- ngnix配置
- CentOS7下安装ngnix
- centOS7 下安装ngnix
- ngnix 集群和配置(mysql ,fast php 安装)
- ngnix + php-fpm 安装
- 点滴 ngnix php mysql
- ngnix+openssl+pcre+php
- Ngnix安装与配置
- ngnix 防盗链配置
- ngnix反向代理配置
- ngnix-fastcgi通用配置
- HashMap 源代码
- Dex动态加载的C语言部分
- 本周学习计划
- [1040]:As Easy As A+B(将输入的数排序)
- 九度oj-Zero-complexity Transposition
- CentOS7配置Ngnix+PHP
- 【远程管理】Mac下的putty远程管理软件
- NIO的简单例子
- 待机、睡眠和休眠的区别
- nyoj--1058--部分和问题(dfs)
- VS2010 Meshlab编译
- 【“知原理”检验题目——第11周】
- sublime text 3 无法通过pacakage controll 打开pacakage install解决办法
- spring+cxf+tomcat错误