搭建linux+nginx+mysql+php环境
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了搭建linux+nginx+mysql+php环境,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含10270字,纯文字阅读大概需要15分钟。
内容图文
![搭建linux+nginx+mysql+php环境](/upload/InfoBanner/zyjiaocheng/485/2c3c085dbb3d4d1b9b16c739870d7c7e.jpg)
./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-openssl=/usr/ --with-pcre=/usr/local/src/pcre-8.31注意:--with-pcre=/usr/local/src/pcre-8.31指向的是源码包解压的路径,而不是安装的路径,否则会报错 make make install /usr/local/nginx/sbin/nginx #启动nginx 设置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 :wq! #保存退出 chmod 775 /etc/rc.d/init.d/nginx #赋予文件执行权限 chkconfig nginx on #设置开机启动 /etc/rc.d/init.d/nginx restart #重启 service nginx restart ======================================================= 安装libmcrypt cd /usr/local/src tar zxvf libmcrypt-2.5.8.tar.gz #解压 cd libmcrypt-2.5.8 #进入目录 ./configure #配置 make #编译 make install #安装 ======================================================= 安装php cd /usr/local/src tar -zvxf php-5.3.5.tar.gz cd php-5.3.5 mkdir -p /usr/local/php5 #建立php安装目录
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl #配置make #编译 make install #安装 cp php.ini-production /usr/local/php5/etc/php.ini #复制php配置文件到安装目录 rm -rf /etc/php.ini #删除系统自带配置文件 ln -s /usr/local/php5/etc/php.ini /etc/php.ini #添加软链接 cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf#拷贝模板文件为php-fpm配置文件 vi /usr/local/php5/etc/php-fpm.conf #编辑 user = www #设置php-fpm运行账号为www group = www #设置php-fpm运行组为www pid = run/php-fpm.pid #取消前面的分号 设置 php-fpm开机启动 cp /usr/local/src/php-5.3.5/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm#拷贝php-fpm到启动目录 chmod +x /etc/rc.d/init.d/php-fpm #添加执行权限 chkconfig php-fpm on #设置开机启动 vi /usr/local/php5/etc/php.ini #编辑配置文件 找到: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======================================================= 配置nginx支持php vi /usr/local/nginx/conf/nginx.conf #编辑配置文件,需做如下修改 user www www; #首行user去掉注释,修改Nginx运行组为www www;必须与/usr/local/php5/etc/php-fpm.conf中的user,group配置相同,否则php运行出错
location / {
root /usr/local/nginx/html;
index index.PHP index.html index.htm;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name;
include fastcgi_params;
}
搭建linux+nginx+mysql+php环境
标签:cal state stop tcp sys strong min related useradd
本文系统来源:http://www.cnblogs.com/hechunhua/p/7064819.html
内容总结
以上是互联网集市为您收集整理的搭建linux+nginx+mysql+php环境全部内容,希望文章能够帮你解决搭建linux+nginx+mysql+php环境所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。