当前位置:Gxlcms > PHP教程 > nginx-安装好Vagrantlarval/homestead之后,启动虚拟机无法index.SegmentFault

nginx-安装好Vagrantlarval/homestead之后,启动虚拟机无法index.SegmentFault

时间:2021-07-01 10:21:17 帮助过:39人阅读

装好虚拟机后,Vagrant up虚拟机启动,访问设定的home地址只显示welcome to nginx,无法渲染出phpinfo();

这是nginx.conf:

  1. <code>user vagrant;
  2. worker_processes auto;
  3. pid /run/nginx.pid;
  4. events {
  5. worker_connections 768;
  6. # multi_accept on;
  7. }
  8. http {
  9. ##
  10. # Basic Settings
  11. ##
  12. sendfile on;
  13. tcp_nopush on;
  14. tcp_nodelay on;
  15. keepalive_timeout 65;
  16. types_hash_max_size 2048;
  17. # server_tokens off;
  18. server_names_hash_bucket_size 64;
  19. # server_name_in_redirect off;
  20. include /etc/nginx/mime.types;
  21. default_type application/octet-stream;
  22. ##
  23. #Server settings
  24. ##
  25. server {
  26. listen 80;
  27. server_name fancygo.app;
  28. location ~ \.(php|html|htm)$ {
  29. fastcgi_pass unix:/run/php-fpm.sock;
  30. fastcgi_index index.php;
  31. include fastcgi.conf;
  32. root /home/vagrant/Code/FancyGo/public;
  33. }
  34. }
  35. ##
  36. # SSL Settings
  37. ##
  38. ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
  39. ssl_prefer_server_ciphers on;
  40. ##
  41. # Logging Settings
  42. ##
  43. access_log /var/log/nginx/access.log;
  44. error_log /var/log/nginx/error.log;
  45. ##
  46. # Gzip Settings
  47. ##
  48. gzip on;
  49. gzip_disable "msie6";
  50. # gzip_vary on;
  51. # gzip_proxied any;
  52. # gzip_comp_level 6;
  53. # gzip_buffers 16 8k;
  54. # gzip_http_version 1.1;
  55. # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
  56. ##
  57. # Virtual Host Configs
  58. ##
  59. include /etc/nginx/conf.d/*.conf;
  60. #include /etc/nginx/sites-enabled/*;
  61. }
  62. #mail {
  63. # # See sample authentication script at:
  64. # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
  65. #
  66. # # auth_http localhost/auth.php;
  67. # # pop3_capabilities "TOP" "USER";
  68. # # imap_capabilities "IMAP4rev1" "UIDPLUS";
  69. #
  70. # server {
  71. # listen localhost:110;
  72. # protocol pop3;
  73. # proxy on;
  74. # }
  75. #
  76. # server {
  77. # listen localhost:143;
  78. # protocol imap;
  79. # proxy on;
  80. # }
  81. #}
  82. </code>

这是我的homestead.yaml:

  1. <code>---
  2. ip: "192.168.10.10"
  3. memory: 2048
  4. cpus: 1
  5. provider: virtualbox
  6. authorize: ~/.ssh/id_rsa.pub
  7. keys:
  8. - ~/.ssh/id_rsa
  9. folders:
  10. - map: ~/Sites/FancyGo
  11. to: /home/vagrant/Code/FancyGo
  12. sites:
  13. - map: FancyGo.app
  14. to: /home/vagrant/Code/FancyGo/public
  15. databases:
  16. - homestead
  17. # blackfire:
  18. # - id: foo
  19. # token: bar
  20. # client-id: foo
  21. # client-token: bar
  22. # ports:
  23. # - send: 50000
  24. # to: 5000
  25. # - send: 7777
  26. # to: 777
  27. # protocol: udp
  28. </code>

请各位帮忙看看问题出在哪里?该怎么配置nginx?

另外,很诡异的是我即使把nginx关了,访问设定的map地址都还能出现“welcome to nginx”我真是日了狗了~原来是map的地址对应的ip地址是“127.0.53.53”,这是个什么鬼~

回复内容:

装好虚拟机后,Vagrant up虚拟机启动,访问设定的home地址只显示welcome to nginx,无法渲染出phpinfo();

这是nginx.conf:

  1. <code>user vagrant;
  2. worker_processes auto;
  3. pid /run/nginx.pid;
  4. events {
  5. worker_connections 768;
  6. # multi_accept on;
  7. }
  8. http {
  9. ##
  10. # Basic Settings
  11. ##
  12. sendfile on;
  13. tcp_nopush on;
  14. tcp_nodelay on;
  15. keepalive_timeout 65;
  16. types_hash_max_size 2048;
  17. # server_tokens off;
  18. server_names_hash_bucket_size 64;
  19. # server_name_in_redirect off;
  20. include /etc/nginx/mime.types;
  21. default_type application/octet-stream;
  22. ##
  23. #Server settings
  24. ##
  25. server {
  26. listen 80;
  27. server_name fancygo.app;
  28. location ~ \.(php|html|htm)$ {
  29. fastcgi_pass unix:/run/php-fpm.sock;
  30. fastcgi_index index.php;
  31. include fastcgi.conf;
  32. root /home/vagrant/Code/FancyGo/public;
  33. }
  34. }
  35. ##
  36. # SSL Settings
  37. ##
  38. ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
  39. ssl_prefer_server_ciphers on;
  40. ##
  41. # Logging Settings
  42. ##
  43. access_log /var/log/nginx/access.log;
  44. error_log /var/log/nginx/error.log;
  45. ##
  46. # Gzip Settings
  47. ##
  48. gzip on;
  49. gzip_disable "msie6";
  50. # gzip_vary on;
  51. # gzip_proxied any;
  52. # gzip_comp_level 6;
  53. # gzip_buffers 16 8k;
  54. # gzip_http_version 1.1;
  55. # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
  56. ##
  57. # Virtual Host Configs
  58. ##
  59. include /etc/nginx/conf.d/*.conf;
  60. #include /etc/nginx/sites-enabled/*;
  61. }
  62. #mail {
  63. # # See sample authentication script at:
  64. # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
  65. #
  66. # # auth_http localhost/auth.php;
  67. # # pop3_capabilities "TOP" "USER";
  68. # # imap_capabilities "IMAP4rev1" "UIDPLUS";
  69. #
  70. # server {
  71. # listen localhost:110;
  72. # protocol pop3;
  73. # proxy on;
  74. # }
  75. #
  76. # server {
  77. # listen localhost:143;
  78. # protocol imap;
  79. # proxy on;
  80. # }
  81. #}
  82. </code>

这是我的homestead.yaml:

  1. <code>---
  2. ip: "192.168.10.10"
  3. memory: 2048
  4. cpus: 1
  5. provider: virtualbox
  6. authorize: ~/.ssh/id_rsa.pub
  7. keys:
  8. - ~/.ssh/id_rsa
  9. folders:
  10. - map: ~/Sites/FancyGo
  11. to: /home/vagrant/Code/FancyGo
  12. sites:
  13. - map: FancyGo.app
  14. to: /home/vagrant/Code/FancyGo/public
  15. databases:
  16. - homestead
  17. # blackfire:
  18. # - id: foo
  19. # token: bar
  20. # client-id: foo
  21. # client-token: bar
  22. # ports:
  23. # - send: 50000
  24. # to: 5000
  25. # - send: 7777
  26. # to: 777
  27. # protocol: udp
  28. </code>

请各位帮忙看看问题出在哪里?该怎么配置nginx?

另外,很诡异的是我即使把nginx关了,访问设定的map地址都还能出现“welcome to nginx”我真是日了狗了~原来是map的地址对应的ip地址是“127.0.53.53”,这是个什么鬼~

人气教程排行