How to setup/configure laravel project on cloud server - html

I have this laravel application on /var/www/html/application-folder/public_html
When I enter the apache server IP it doesn't load the laravel application instead it displays the Apache home page
How can I display the url /var/www/html/application-folder/public_html ?
When I type the full url I get the following error:
Forbidden
You don't have permission to access /folder/public_html/index.php on this server.
Apache/2.2.15 (CentOS) Server

If you have full root access to your server then you can
Step 1
upload your laravel project from the development machine(local) to the /var/www on your server - upload all folders except vendor and node_modules
Step2
once the project is uploaded, run composer install, if you need any of the node packages run npm install
Step 3
create virtual host for your site with DocumentRoot /var/www/yourProjectFolder/public
Step 4
Ensure storage folder has write permissions for your apache/webserver user - recursively
Step 5
Ensure that public folder has appropriate permissions - recursively, if you have uploaded the project as root then you will need to change the owner/permissions
Following this workflow you will be able to get your Laravel site up and running.
Important distinction to make here is that you have full root access to your server and that you can install composer and/or npm on your server before proceeding with the workflow.
If you can't install composer and/or npm on your server, then you have to upload the vendor directory to your server as well (and if you need any node packages then the node_modules as well) - following the documentation link in my comment above will help you.
Refer Virtual Host on Cent Os 6

Related

How to place files outside app deployment directory in AWS Elastic Beanstalk?

In AWS EB, how to place my environment.properties (contains app runtime config like port, logs dir, DB info, security keys, etc.) under /var/env_config/myapp, so it can be referred by the app at runtime?
Though my further plan is to put this environment.properties in a secure non app directory of local or remote file system as it contains sensitive information.
global.env = propsReader(path.join(process.env.ENV_PATH, 'env-main.properties'));
On the EB, I have added an Environment property 'ENV_PATH = /var/env_config/myapp'
EB logs:
web: > myapp#1.0.0 start /var/app/current
web: > node src/app-main.js
web: 8266 [
web: '/opt/elasticbeanstalk/node-install/node-v12.18.1-linux-x64/bin/node',
web: '/var/app/current/src/app-main.js'
web: ]
web: /var/env_config/myapp
web: internal/fs/utils.js:230
web: throw err;
web: ^
web: Error: ENOENT: no such file or directory, open '/var/env_config/myapp/env-main.properties'
I just wanna deploy my application in the same fashion in AWS EB or Docker or VM or local machine, with just an environment property saying where the required runtime input files are.
How to access Elastic Beanstalk file system to configure my .properties file?
Not sure what do you mean by "accessing file system", but usually you would create .ebextensions folder in your project directory. The extensions are commonly used for running commands or scripts when you are deploying your app. There are special sections for that:
commands: You can use the commands key to execute commands on the EC2 instance. The commands run before the application and web server are set up and the application version file is extracted.
container_commands: You can use the container_commands key to execute commands that affect your application source code. Container commands run after the application and web server have been set up and the application version archive has been extracted, but before the application version is deployed.
Therefore, you could use the above sections to modify your .properties file during deployment of your application into EB.

PhpStorm - Configuring deployment remote server for debug

I want to debug in a remote server, which is, by the way, a Vagrant machine. Not really a remote server, but this has a peculiar setup: the shared host/vagrant machine folder isn't related to the web server files.
The server is configured with Zend Framework.
I have, locally, to deploy to the machine the following folders (as Zend Framework structure):
/home/user/webStuff/web
Inside web: config, data, module, vendor and public folders
Inside public folder I have the index.php, which handles all server requests.
Following is the server deployment configuration:
When I press "Test SFTP Connection" everything is fine. When I press "Open", the website opens.
And here, is the "Mappings" tab on the deployment configuration
Everything seems OK, here. At least from my point of view.
But when I test the settings, in Run -> WebServer Debug Validation, it gives me "Failed to collect files: Invalid relative file name". I've tried more settings, like placing /web/public in Web path, but with no success.
In Settings -> Languages & Frameworks -> PHP I have a good configuration for the server vagrantmachine.com, with XDebug version correctly displayed.
Also, I've placed the following in xdebug.ini:
xdebug.remote_connect_back = 1
xdebug.remote_enable=1
I've searched and tried a lot, but with no success.
I'm no specialist in these server configuration things, but if you need any information, just ask.
"Deployment path on server" and "Root Path" were wrong.
Like #Eugene Morozov said, I changed the root path to "/opt/webStuff" and deployment path to "/" and it worked out.

Gunicorn: No module named '/path/to/my/django/project'

I was using gunicorn with nginx on Ubuntu 16.04 system to deploy a django project and want to create a systemd service for gunicorn. In /lib/systemd/system/gunicorn-mywebsite.service, I write following codes:
ExecStart=/home/myusername/sites/pythonEnv/bin/gunicorn --bind unix:/tmp/mywebsite.socket /path/to/my/django/project.wsgi:application
But when I ran service gunicorn-mywebsite start, there was problem No module named '/path/to/my/django/project'.
If I run the same command my django project directory with relative path of my wsgi:application, it will work.
How can I fix this problem?
You can't give gunicorn a path to a file, it needs to be a module path, with application entry point name. So just project.wsgi:application. If the directory containing project is not in your path, then use the --pythonpath to gunicorn to tell it where it is.

Couchbase Mobile (Sync Gateway) sample TODOlite application doesn't replicate; complains _facebook doesn't exist

My objective: get https://github.com/couchbaselabs/ToDoLite-iOS syncing with a Couchbase Server and sync gateway on localhost rather than the default demo URL.
I run sync gateway like so: bin/sync_gateway -url http://localhost:8091
And then the only thing I changed in the example is:
-#define kSyncGatewayUrl #"http://demo.mobile.couchbase.com/todolite"
+#define kSyncGatewayUrl #"http://localhost:4984/sync_gateway/"
And when I run
Error: Error Domain=CBLHTTP Code=404 "404 not_found" UserInfo=0x7ff11941fb50 {NSURL=http://localhost:4984/sync_gateway/_facebook, NSLocalizedFailureReason=not_found, NSLocalizedDescription=404 not_found}
How do I fix this?
I solved it. The reason is that I ran sync_gateway without enabling Facebook registration support.
Normally this is done in config.json file. In fact, this configuration file was supplied in ToDoLite all along.
It is crucial that you launch sync_gateway with this configuration file. The README actually states this but in a loose and casual way...
cd ToDoLite-iOS
sync_gateway -url http://localhost:8091 sync-gateway-config.json
NB: I assume above that sync_gateway has been made accessible through $PATH. It's a good idea to do that anyway.
Also, I didn't pay attention to the dbname. So you'll need to replace
#define kSyncGatewayUrl #"http://demo.mobile.couchbase.com/todolite"`
with
#define kSyncGatewayUrl #"http://localhost:4984/todos"
So, what's the complete sequence of steps to get it working?:
If you want to wipe everything on the server, rm -rf Library/Application\ Support/Couchbase and start over. Homebrew cask hides this setting somewhere else where it's hard to reset so a manual install is very recommended.
Install Couchbase Server
Set up login credentials if fresh install; otherwise just login
Create a bucket (a database) with name todos on the cluster. This is the dbname used by TODOLite.
Launch sync gateway. Be sure to pass in the replication URL AND the JSON config file.
bin/sync_gateway -url http://localhost:8091 sync-gateway-config.json; keep sync gateway running
In the TODOLite AppDelegate.m, change kSyncGatewayUrl:
#define kSyncGatewayUrl #"http://localhost:4984/todos". Notice the name of the database is necessary!
(Optionally) Access the administrator interface of the sync gateway by going to http://localhost:4985/_admin/db/sync_gateway/sync. You can set up the sync function here.
In case you're wondering where those port numbers came from, check out
ports Couchbase Server uses
ports Sync Gateway uses
4984 — SG API port
4985 — SG admin server
The default remote sync URL will be defined in different files depending on the version of the project you download (iOS, Android, PhoneGap, and Motion). To find the appropriate string to change simply search through your project for the URL "http://demo.mobile.couchbase.com/todolite" and replace it with the URL of your new sync gateway database.

Subdirectories in openshift project cannot be found

I built a site using a php openshift project and accessing the root directory via http works fine. However, all the root directories give me a 404 not found, like this one: http://test.toppagedesign.com/sites/
I checked with ssh, and /app-root/repo/sites and app-deployments/current/repo/sites/ both exist.
EDIT
Added a directory called php and now I have 503 errors for everything...
EDIT 2
I deleted the php directory, now the 503 errors are gone. However, I do still get 404 errors for the subdirectory.
Here is my directory tree: http://pastebin.com/hzPCsCua
And I do use git to deploy my project.
php is one of the alternate document roots that you can use, please see the March Release blog post here about this (https://www.openshift.com/blogs/openshift-online-march-2014-release-blog)
As for the sub-directories not working, can you ssh into your server and use the "tree" command to post the directory/file structure of your project? Also are you using Git to deploy your project or editing files directly on the server?
You need to have an index.php or index.html file in any directory that you want to work like app-domain.rhcloud.com/sites , if you just have sub-directories, how would it know what to show? Also, indexing (showing a folders contents) is not enabled for security reasons, and I believe there is no way to enable it.
This sounds like it could be a problem with how you are serving your static content.
I recently created a new sample app for OpenShift that includes:
a basic static folder
an .htaccess file (for serving assets in production)
support for using php's local server to handle the static content (in your dev environments)
Composer and Silex - a great starting point for most new PHP apps
You can serve the project locally if you have PHP-5.4 (or better), available in your dev environment:
php -S localhost:8080 -t static app.php
For a more advanced project that is built on the same foundation, take a look at this PHP+MongoDB mapping example. I wrote up a blog post with some notes on my process for composing that app as well.
Hope these examples help!