Nginx Configuration
The support of swoole_http_server for Http is not complete. So, you should configure your swoole server with nginx proxy in your production environment.
- map $http_upgrade $connection_upgrade {
- default upgrade;
- '' close;
- }
- server {
- listen 80;
- server_name your.domain.com;
- root /path/to/laravel/public;
- index index.php;
- location = /index.php {
- # Ensure that there is no such file named "not_exists"
- # in your "public" directory.
- try_files /not_exists @swoole;
- }
- # any php files must not be accessed
- #location ~* \.php$ {
- # return 404;
- #}
- location / {
- try_files $uri $uri/ @swoole;
- }
- location @swoole {
- set $suffix "";
- if ($uri = /index.php) {
- set $suffix ?$query_string;
- }
- proxy_set_header Host $http_host;
- proxy_set_header Scheme $scheme;
- proxy_set_header SERVER_PORT $server_port;
- proxy_set_header REMOTE_ADDR $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection $connection_upgrade;
- # IF https
- # proxy_set_header HTTPS "on";
- proxy_pass http://127.0.0.1:1215$suffix;
- }
- }
当前内容版权归 Laravel-Swoole 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Laravel-Swoole .