douwei1944 2017-08-15 15:21
浏览 76

Apache服务器上的Symfony 3 // Postman POST请求在url中没有app.php时无效

I have a working Symfony 3 API on an Apache Server - more info here and here these are already resolved

I am now facing a routing problem I think, my postman POST methods working fine if use a URL like: https://example.com/app.php/mcPDF/ but when I try with URL: https://example.com/mcPDF/ it says 404 not found.

I tried several answers here, like changing the htaccess IfModule mod_rewrite.c> section and added various settings in 000-default.conf file like:

<Directory /var/www/html/pdf/web>
    AllowOverride All
    Order Allow,Deny
    Allow from All
    DirectoryIndex app.php
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app.php [QSA,L]
    </Directory>

and every time I do changes I do:

- bin/console cache:clear --env=prod --no-warmup
- bin/console cache:warmup --env=prod

and I also did the sudo a2enmod rewrite and restarted the server many times

Please advise, let me know what info you need more

  • 写回答

1条回答 默认 最新

  • dongtao9095 2017-08-15 16:10
    关注

    All my PROD servers use configuration below and they all work fine. Try to update yours accordingly to see what happens.

    # $ nano /etc/apache2/sites-available/000-default.conf
    
    <VirtualHost *:80>
        DocumentRoot /var/www/my_app/current/web
    
        <Directory /var/www/my_app/current/web>
            AllowOverride All
            Require all granted
            Allow from All
    
            <IfModule mod_rewrite.c>
                Options -MultiViews
                RewriteEngine On
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteRule ^(.*)$ app.php [QSA,L]
            </IfModule>
        </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/${APP_NAME}-error.log
        CustomLog ${APACHE_LOG_DIR}/${APP_NAME}-access.log combined
    </VirtualHost>
    

    UPDATE: Stage dependent configurations are shown here in details. http://www.inanzzz.com/index.php/post/0ew3/deploying-a-symfony-applications-to-staging-and-production-servers-with-capistrano

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作