普通 LAMP 模式

优质
小牛编辑
131浏览
2023-12-01

基于php-fpm来运行swoole/framework的MVC程序,这是传统的LAMP模式。

Nginx配置

server {
    listen 80;
    root /home/htf/workspace/php/swoole.com;

    index           index.php index.html;
    server_name     local.swoole.com;

    location / {
        if (!-e $request_filename) {
            rewrite ^/(.*)$ /index.php;
        }
    }

    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
    }
}

Apache

<VirtualHost *:80>
    ServerName www.swoole.com
    DocumentRoot /data/webroot/www.swoole.com

    <Directory "/data/webroot/www.swoole.com">
        Options Indexes FollowSymLinks
        AllowOverride None
    </Directory>

    <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
            RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ /index.php [L]
    </IfModule>
</VirtualHost>