xml地图|网站地图|网站标签 [设为首页] [加入收藏]

Nginx编译安装PHP,linux环境搭建lnmp环境

来源:http://www.ccidsi.com 作者:呼叫中心培训课程 人气:72 发布时间:2019-06-26
摘要:CentOS 6.4 install nginx php5.4 mysql linux情状搭建lnmp蒙受,linux搭建lnmp [原创]编译安装lnmp蒙受希图软件:nginx1.10.3 php-5.5.12 mariadb10.0.8(数据库在此选取的yum安装) 只要急需编译安装的能够给自

CentOS 6.4 install nginx php5.4 mysql

linux情状搭建lnmp蒙受,linux搭建lnmp

[原创]编译安装lnmp蒙受希图软件:nginx1.10.3 php-5.5.12 mariadb10.0.8(数据库在此选取的yum安装)

只要急需编译安装的能够给自个儿留言,小编继续再公布出去! 

借助于包均已yum在线安装一、yum安装mariadb数据库yum -y install mariadb*起步数据库systemctl start mariadb修改root密码grant all privileges on *.* to 'root'@'localhost' identified by "root" with grant option;grant all privileges on *.* to 'root'@'%' identified by "root" with grant option;flush privileges;二、安装nginx1、安装依赖包yum install -y pcre pcre-devel openssl openssl-devel gcc-c 2、创设运维进程的用户groupadd nginxuseradd -g nginx -s /bin/nologin nginx3、编写翻译安装nginx作者在此刻的软件都位居myapp目录下的tar -zxvf nginx-1.10.3.tar.gz #解压到当前目录cd nginx-1.10.3./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-pcre --with-http_gzip_static_module --without-http_gzip_module --with-http_stub_status_modulemakemake install4、运转nginxcd /usr/local/nginx/sbin./nginx5、验证:浏览器访问 -y install libxml2* curl curl-devel libpng-devel libpng openldap openldap-devel freetype freetype-devel libjpeg-devel libpng-devel2、编写翻译安装phptar -xjf php-5.5.12.tar.bz2cd php-5.5.12./configure^C-prefix=/usr/local/php --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local/ --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64makemake testmake install3、修改php文件cp /myapp/php-5.5.12/php.ini-production /usr/local/php/etc/php.inicp /usr/local/php/etc/php-fpm.conf.default php-fpm.conf4、运维php/usr/local/php/sbin/php-fpm检查运营是不是中标netstat -lntp | grep php-fpm彰显 tcp 0 0 127.0.0.1:7000 0.0.0.0:* LISTEN 77087/php-fpm: mast四、整合nginx匡助php1、修改nginx配置文件vi /usr/local/nginx/conf/nginx.conf[[email protected] conf]# cat nginx.conf | grep -v "#"user nginx nginx;worker_processes 1;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr

  • $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; charset utf8; location / { root html; index index.html index.htm index.php; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } 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; } }2、成立index.php文件测试cd /usr/local/nginx/htmlvi index.php[[email protected] html]# cat index.php <?php $link=mysql_connect("172.16.20.112","root","root"); if(!$link) echo "MySQL数据库连接战败!!"; else echo "MySQL数据库连接成功!!"; phpinfo();?> 保存退出chmod 775 index.php3、验证浏览器

非凡大家请提出来!!感激!! 

[原创]编写翻译安装lnmp环境筹算软件:nginx1.10.3 php-5.5.12 mariadb10.0.8(数据库在此采纳的yum安装) 假设急需编...

./configure  --prefix=/data/system/pcre8
make&&make install

编写翻译安装Linux Nginx
tar zxvf nginx-0.6.35.tar.gz cd nginx-0.6.35/

download nginx

暗中认可安装:./configure make && make install
私下认可情形下,Nginx 会棉被服装置在 /usr/local/nginx。通过设确定人员编制写翻译选项,你能够改造这么些设定。

/usr/sbin/groupadd nginx
/usr/sbin/useradd -g nginx nginx
/usr/sbin/usermod -a -G webuser nginx (Add wordpress user 'webuser' into nginx group)

指确定人员编制写翻译选项安装,如:
./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
cd ../

./configure --user=nginx --group=nginx --prefix=/data/system/nginx --with-pcre=/data/system/source/nginx/pcre-8.34 --with-zlib=/data/system/source/nginx/zlib-1.2.8 --with-http_ssl_module

七、Linux Nginx创建fcgi.conf文件

yum install libxml2 libxml2-devel curl-devel free-type-devel

1.rm -f /usr/local/webserver/nginx/conf/fcgi.conf 
2.vi /usr/local/webserver/nginx/conf/fcgi.conf
输入以下内容:

wget
./configure --prefix=/data/system/libiconv

1.fastcgi_param GATEWAY_INTERFACE CGI/1.1; 
2.fastcgi_param SERVER_SOFTWARE nginx; 

Compile PHP-5.4

  1. 4.fastcgi_param QUERY_STRING $query_string; 
    5.fastcgi_param REQUEST_METHOD $request_method; 
    6.fastcgi_param CONTENT_TYPE $content_type; 
    7.fastcgi_param CONTENT_LENGTH $content_length; 
  2. 9.fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    10.fastcgi_param SCRIPT_NAME $fastcgi_script_name; 
    11.fastcgi_param REQUEST_URI $request_uri; 
    12.fastcgi_param DOCUMENT_URI $document_uri; 
    13.fastcgi_param DOCUMENT_ROOT $document_root; 
    14.fastcgi_param SERVER_PROTOCOL $server_protocol; 
  3. 16.fastcgi_param REMOTE_ADDR $remote_addr; 
    17.fastcgi_param REMOTE_PORT $remote_port; 
    18.fastcgi_param SERVER_ADDR $server_addr; 
    19.fastcgi_param SERVER_PORT $server_port; 
    20.fastcgi_param SERVER_NAME $server_name; 
  4. 22.# PHP only, required if PHP was built with --enable-force-cgi-redirect 
    23.fastcgi_param REDIRECT_STATUS 200;

./configure --prefix=/data/system/php5.4 --with-zlib --with-libxml --enable-gd-native-ttf --enable-gd-jis-conv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-ttf=shared  --enable-mbstring --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/lib/mysql/mysql.sock  --with-config-file-path=/data/system/php5.4/etc --with-iconv=/data/system/libiconv --disable-ipv6 --enable-static --enable-zend-multibyte --enable-inline-optimization --enable-zend-multibyte --enable-sockets --enable-soap  --with-gettext --enable-sysvsem --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect  --with-curl --with-curlwrappers --enable-mbregex --enable-bcmath --enable-shmop --enable-suhosin --with-libevent=shared --with-gd --with-mcrypt --enable-zip --enable-soap --enable-mime-magic --enable-cgi --enable-xml --enable-ftp --enable-json --enable-ctype --enable-gd-native-ttf

八、编辑Linux Nginx配置文件

cp php.ini-production   /data/system/php5.4/etc/php.ini
cp /data/system/php5.4/etc/php-fpm.conf.default /data/system/php5.4/etc/php-fpm.conf
killall php-fpm

1.rm -f /usr/local/webserver/nginx/conf/nginx.conf 
2.vi /usr/local/webserver/nginx/conf/nginx.conf
输入以下内容:

cp php-5.4.26/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod x /etc/init.d/php-fpm
chkconfig on php-fpm
service php-fpm restart

1.user www www; 
2.worker_processes 8; 
3.error_log /usr/local/webserver/nginx/logs/logs/nginx_error.log crit; 
4.pid /usr/local/webserver/nginx/logs/nginx.pid; 
5.worker_rlimit_nofile 51200; 
6.events { 
7.use epoll; 
8.worker_connections 51200; 
9.} 

(= /data/system/php5.4/sbin/php-fpm -c /data/system/php5.4/etc/php.ini -y /data/system/php5.4/etc/php-fpm.conf)

  1. 11.http { 
    12.include mime.types; 
    13.default_type application/octet-stream; 
    14.charset utf-8; 
  2. 16.server_names_hash_bucket_size 128; 
    17.client_header_buffer_size 32k; 
    18.large_client_header_buffers 4 32k; 
    19.client_max_body_size 8m; 
  3. 21.sendfile on; 
    22.tcp_nopush on; 
    23.keepalive_timeout 60; 
    24.tcp_nodelay on; 
  4. 26.fastcgi_connect_timeout 300; 
    27.fastcgi_send_timeout 300; 
    28.fastcgi_read_timeout 300; 
    29.fastcgi_buffer_size 64k; 
    30.fastcgi_buffers 8 64k; 
    31.fastcgi_busy_buffers_size 128k; 
    32.fastcgi_temp_file_write_size 128k; 
  5. 34.gzip on; 
    35.gzip_min_length 1k; 
    36.gzip_buffers 4 16k; 
    37.gzip_http_version 1.0; 
    38.gzip_comp_level 2; 
    39.gzip_types text/plain application/x-javascript text/css application/xml; 
    40.gzip_vary on; 
  6. 42.#limit_zone crawler $binary_remote_addr 10m; 
    43.#三个站点设置,站点文件夹必须放在Nginx的html目录,不然不匡助多站点 
    44.server { 
    45.listen 80; 
    46.server_name www.v-ec.com; 
    47.root /usr/local/webserver/nginx/html/www.v-ec.com; 
    48.index index.php index.html; 
  7. 50.location ~ .*.(php|php5)?$ {  
    51.#fastcgi_pass unix:/tmp/php-cgi.sock; 
    52.fastcgi_pass 127.0.0.1:9000; 
    53.fastcgi_index index.php; 
    54.include fcgi.conf; 
    55.} 
  8. 57.location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ { 
    58.expires 30d;  59.} 
  9. 61.location ~ .*.(js|css)?$ { 
    62.expires 6h; 
    63.} 
  10. 65.log_format veclog '$remote_addr - $remote_user [$time_local] "$request" ' 
    66.'$status $body_bytes_sent "$http_referer" ' 
    67.'"$http_user_agent" $http_x_forwarded_for'; 
    68.access_log logs/vec.log veclog; 
    69.} 
    70.#多少个站点设置,站点文件夹必须放在Nginx的html目录,不然不扶助多站点 
    71.server { 
    72.listen 80; 
    73.server_name www.w3cgroup.com; 
    74.root /usr/local/webserver/nginx/html/www.w3cgroup.com; 
    75.index index.php index.html; 
  11. 77.location ~ .*.(php|php5)?$ {  
    78.#fastcgi_pass unix:/tmp/php-cgi.sock; 
    79.fastcgi_pass 127.0.0.1:9000; 
    80.fastcgi_index index.php; 
    81.include fcgi.conf; 
    82.} 
  12. 84.location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ { 
    85.expires 30d; 
    86.} 
  13. 88.location ~ .*.(js|css)?$ { 
    89.expires 6h; 
    90.} 
  14. 92.log_format w3cclog '$remote_addr - $remote_user [$time_local] "$request" ' 
    93.'$status $body_bytes_sent "$http_referer" ' 
    94.'"$http_user_agent" $http_x_forwarded_for'; 
    95.access_log logs/w3c.log w3clog; 
    96.} 
    97.}

本文由68399皇家赌场发布于呼叫中心培训课程,转载请注明出处:Nginx编译安装PHP,linux环境搭建lnmp环境

关键词: 68399皇家赌场

最火资讯