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 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog