2013-06-05 1 views
1

phpmyadmin이 제공되는 것과 동일한 스타일로 내 응용 프로그램을 제공하도록 프로덕션 서버를 만들려고합니다. example.com/phpmyadmin처럼 example.com/myappname입니다.Laravel 4 nginx servername/myappname

내의 nginx/사이트-가능/기본값은 다음과 같습니다 : 누군가가 이것에 대한 작업의 conf이있는 경우

server { 
     listen 80 default_server; 
     listen [::]:80 default_server ipv6only=on; 

     root /var/www; 
     index index.html index.htm index.php; 

     server_name _; 

     location ~ \.php$ { 
       #fastcgi_pass 127.0.0.1:9000; 
       # With php5-fpm: 
       fastcgi_pass unix:/var/run/php5-fpm.sock; 
       fastcgi_index index.php; 
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
       include fastcgi_params; 

     } 

     location /myapp { 
       root /var/www/myapp/public/; 
       index index.php; 
     } 

     location /phpmyadmin { 
       root /usr/share/; 
       index index.php index.html index.htm; 
       location ~ ^/phpmyadmin/(.+\.php)$ { 
         try_files $uri =404; 
         root /usr/share/; 
         fastcgi_pass unix:/var/run/php5-fpm.sock; 
         fastcgi_index index.php; 
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
         include /etc/nginx/fastcgi_params; 
       } 
       location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { 
         root /usr/share/; 
       } 
     } 
     location /phpMyAdmin { 
       rewrite ^/* /phpmyadmin last; 
     } 


     location ~ /\.ht { 
       deny all; 
     } 
} 

그래서, 나도 그것을 가지고 싶습니다!

+0

아마도 설정과 작동하는 것을 공유 할 수 있습니까? –

답변

0

위치가 /phpmyadmin 인 경우 fast_cgi 구성을 통해 PHP-FPM에 요청을 전달하는 데 추가 구성이 있음을 알 수 있습니다.

/myapp 위치에 대해서도이를 수행해야합니다.

당신은 이런 식으로 myapp 위치를 변경할 수 있습니다 : 비교를 위해

location ^/myapp/(.+\.php)$ { 
    root /var/www/myapp/public/; 
    index index.php; 
    fastcgi_split_path_info ^(.+\.php)(/.+)$; 
    fastcgi_pass unix:/var/run/php5-fpm.sock; 
    fastcgi_index index.php; 
    include /etc/nginx/fastcgi_params; 
} 

, 여기 내 Laravel nginx configuration입니다 - 내 응용 프로그램은 "하위 디렉토리"에서 실행하지 않아도하지만.

일부 구성 항목을 변경하여 작업 할 수있는 항목을 확인하십시오. 참고로 Laravel 앱 위치에서 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;을 삭제했습니다. 필요하지 않습니다.

마지막으로, ServerFault에서 더 의미가 있습니까? 더 나은 답변을 얻을 수 있습니다.