配置laravel运行环境出现的问题
1.laravel项目本地运行:php artisan serve
2.apache+laravel:使用了wampserver,但是项目在服务器上一直运行不出来,最后更改了laravel新版本,项目正常运行了。
3.nginx+laravel:其他文件可以访问,但php文件无法正常显示,在配置文件中加入了
listen 127.0.0.1:80; 和
autoindex on;后可以正常访问php文件了,但是运行项目会报
call to undefined function openssl cipher iv length()这个错,问题是 OpenSSL扩展加载失败,然后找到php.ini文件,开启 php_openssl.dll就可以了,也就是去掉extension=openssl前面的注释(注释的写法是;),至此,整个项目可以正常运行了
nginx.conf
server { listen 80; listen 127.0.0.1:80; server_name localhost; root laravel/public; #charset koi8-r; #access_log logs/host.access.log main; location / { index index.html index.htm index.php; # 是否允许访问目录 autoindex on; try_files $uri $uri/ /index.php?$query_string; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9001 # location ~ \.php$ { fastcgi_pass 127.0.0.1:9001; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }