Nginx依赖的包不多,除了常规的编译包,再安装上一下几个开发包就可以了。
sudo yum install pcre-devel zlib-devel openssl-devel
makesudo make installnginx默认安装到/usr/local/nginx路径。2.安装PHP运行环境
sudo yum install php-devel php-fpm php-mysql php-pdo
运行PHP-FPM
sudo php-fpm -D3.安装PHP的mcrypt扩展CentOS 7运行Laravel的一个不方便的地方就是yum没有php的mcrypt扩展,需要手动编译安装一个。 首先需要编译安装libmcrypt。
tar zxvf libmcrypt-2.5.8.tar.gzcd libmcrypt-2.5.8./configuremakesudo make install
; Enable mcrypt extension moduleextension=mcrypt.so
#user  nobody;worker_processes  8;#error_log  logs/error.log;#error_log  logs/error.log  notice;#error_log  logs/error.log  info;#pid        logs/nginx.pid;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;    #tcp_nopush     on;    #keepalive_timeout  0;    keepalive_timeout  65;    client_max_body_size 100m;    gzip  on;    server {        listen       80;        server_name  localhost;        set $root_path '/srv/www/default/html' target='_blank'>public';        root $root_path;                index index.php index.html index.htm;        try_files $uri $uri/ @rewrite;        location @rewrite {                rewrite ^/(.*)$ /index.php?_url=/$1;        }        location ~ .php {                fastcgi_pass 127.0.0.1:9000;                fastcgi_index /index.php;                include /usr/local/nginx/conf/fastcgi_params;                fastcgi_split_path_info       ^(.+.php)(/.+)$;                fastcgi_param PATH_INFO       $fastcgi_path_info;                fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;        }        location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {                root $root_path;        }        location ~ /.ht {                deny all;        }    }    # another virtual host using mix of IP-, name-, and port-based configuration    #    #server {    #    listen       8000;    #    listen       somename:8080;    #    server_name  somename  alias  another.alias;    #    location / {    #        root   html;    #        index  index.html index.htm;    #    }    #}    # HTTPS server    #    #server {    #    listen       443 ssl;    #    server_name  localhost;    #    ssl_certificate      cert.pem;    #    ssl_certificate_key  cert.key;    #    ssl_session_cache    shared:SSL:1m;    #    ssl_session_timeout  5m;    #    ssl_ciphers  HIGH:!aNULL:!MD5;    #    ssl_prefer_server_ciphers  on;    #    location / {    #        root   html;    #        index  index.html index.htm;    #    }    #}}由于PHP-FPM使用apache用户运行,所以修改网站根目录的权限给apache用户。cd /srv/wwwchown -R apache defaultchgrp -R apache default
sudo /usr/local/nginx/sbin -s reload
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。
新闻热点
疑难解答
图片精选